1.集成友盟push提示androidx版本號不一致,需在gradle文件中手動選擇便可,以下android
1 buildscript { 2 repositories { 3 google() 4 jcenter() 5 maven { url 'https://dl.bintray.com/umsdk/release' } 6 } 7 8 dependencies { 9 classpath 'com.android.tools.build:gradle:3.2.1' 10 } 11 12 subprojects { 13 //根據提示使用對應的版本 14 project.configurations.all { 15 resolutionStrategy.eachDependency { details -> 16 if (details.requested.group == 'com.android.support' 17 && !details.requested.name.contains('multidex') ) { 18 details.useVersion "27.1.1" 19 } 20 21 if (details.requested.group == 'androidx.core' 22 && !details.requested.name.contains('androidx') ) { 23 details.useVersion "1.0.0" 24 } 25 if (details.requested.group == 'androidx.coordinatorlayout' 26 && !details.requested.name.contains('androidx') ) { 27 details.useVersion "1.0.0" 28 } 29 if (details.requested.group == 'androidx.documentfile' 30 && !details.requested.name.contains('androidx') ) { 31 details.useVersion "1.0.0" 32 } 33 if (details.requested.group == 'androidx.print' 34 && !details.requested.name.contains('androidx') ) { 35 details.useVersion "1.0.0" 36 } 37 if (details.requested.group=='androidx.arch.core' ) { 38 details.useVersion "2.0.0" 39 } 40 if (details.requested.group=='androidx.drawerlayout' ) { 41 details.useVersion "1.0.0" 42 } 43 if (details.requested.group=='androidx.fragment' ) { 44 details.useVersion "1.0.0" 45 } 46 } 47 } 48 } 49 50 } 51 52 allprojects { 53 repositories { 54 google() 55 jcenter() 56 maven { url 'https://dl.bintray.com/umsdk/release' } 57 } 58 } 59 60 rootProject.buildDir = '../build' 61 subprojects { 62 project.buildDir = "${rootProject.buildDir}/${project.name}" 63 } 64 subprojects { 65 project.evaluationDependsOn(':app') 66 } 67 68 task clean(type: Delete) { 69 delete rootProject.buildDir 70 }
2.打包的時候找不到libflutter.so文件架構
這是對應平臺的so文件不存在形成的,方法是隻選擇一種平臺,通常手機對支持armv7架構,因此在app的build.gradle下設置ndk過濾就好app
1 ndk { 2 //選擇要添加的對應cpu類型的.so庫。 3 abiFilters 'armeabi-v7a' 4 // abiFilters 'arm64-v8a' 5 // 還能夠添加 'x86', 'x86_64', 'mips', 'mips64', 'armeabi', 'armeabi-v7a', 'arm64-v8a' 6 }
可是有個問題,最新的flutter默認只打64位的包,armv7的也會找不到那個so,這個時候就須要改flutter的編譯環境了maven
在如下目錄找到flutter.gradleide
/flutter/packages/flutter_tools/gradle/flutter.gradle
而後找到465行的 getTargetPlatforms方法,修改成以下便可gradle
//whh 獲取目標平臺 private List<String> getTargetPlatforms() {//whh 不管如何配置,都只返回arm32和64位的so // if (!project.hasProperty('target-platform')) { return DEFAULT_PLATFORMS // } // return project.property('target-platform').split(',').collect { // if (!PLATFORM_ARCH_MAP[it]) { // throw new GradleException("Invalid platform: $it.") // } // return it // } }
固然你能夠按照代碼的邏輯把target-platform放到一個配置文件裏,只不過我沒時間去找這個配置文件是在哪裏寫的,若是有興趣,歡迎補充ui