build.gradle文件修改:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app->build.gradle文件修改:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.companyname"
minSdkVersion 22
targetSdkVersion 29
versionCode 1
versionName "1.0"
ndk {
abiFilters 'armeabi-v7a'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
assets.srcDirs = ['../assets']
jniLibs.srcDirs = ['libs']
}
}
buildToolsVersion '29.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile(name: 'egret', ext: 'aar')
}
修改完后重新编译就可成功,之后 Build->Build Bundle(s)/APK(s)->Build APK 打包即可
包的位置在 "项目文件夹\app\build\outputs\apk\debug\app-debug.apk"
去除包中显示的fps等调试信息
到项目 java->com.companyname->MainActivity.java 修改
nativeAndroid.config.showFPS = false;
正式包打包方法
正式包方法:Build->Generate Signed Bundle or APK->APK
然后根据提示填信息就行
正式包的位置:"项目文件夹\app\release\app-release.apk"
*中国大陆的country code是86
jar signature和full apk signature的选择
这是从 Android 7.0引入的一个新的签名机制,它为APK附加了一些特性使其更具安全性,所以这个选项虽然不是强制性的,但最好两个都选,如果选择V2会产生错误可以不选V2
Android Studio 编译错误 Received close_notify during handshake解决
修改build.gradle
buildscript{
repositories{
//jcenter() //把这里注释掉,换成阿里的源
maven{ url'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
google()
}
}
allprojects{
repositories{
//jcenter() //把这里注释掉,换成阿里的源
maven{ url'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
}