Egret打包Apk出現的問題

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'}
 } 
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章