極光和百度的so檔案匯入,確保不會報錯的方法
阿新 • • 發佈:2019-02-01
兩個SDK得這麼放才行:
第一個極光的sdk+百度的sdk 的so檔案,記住不要 armeabi-v7a 會報錯,要不百度的定位會報錯
第二張,百度的sdk 還得這麼放,否則也找不到,報錯
具體的gradle配置如下”
apply plugin: 'com.android.application' //Android annotations apply plugin: 'android-apt' def AAVersion = '3.3.1' android { compileSdkVersion 23 buildToolsVersion "23.0.2" /*api23版本 拋棄了httpClient,需要在此引用library宣告,並在dependencies中引入 *compile "org.apache.httpcomponents:httpcore:4.3.2" * 或者引入httpcore-4.4-beta1.jar * 兩者選其一 * */ useLibrary 'org.apache.http.legacy' /*避免jar包檔案混淆,打包引入不包括以下路徑*/ packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/notice.txt' exclude 'META-INF/license.txt' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LGPL2.1' } defaultConfig { applicationId "com.lvche.lvchedingdang" minSdkVersion 14 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } /**引入so檔案*/ task nativeLibsToJar(type: Zip, description: "create a jar archive of the native libs") { destinationDir file("$projectDir/libs") baseName "Native_Libs2" extension "jar" from fileTree(dir: "libs", include: "**/*.so") into "lib" } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn(nativeLibsToJar) } sourceSets { main { jniLibs.srcDirs = ['libs'] } } //最大堆處理 dexOptions { incremental = true; preDexLibraries = false javaMaxHeapSize "4g" // 2g should be also OK } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:support-v4:22.0.0' /*破碎玻璃動畫引入*/ //compile 'com.android.support:design:22.2.0' compile 'com.android.support:design:23.0.1' compile project(':brokenview') /**搜尋jar**/ compile project(':searchinglibrary') compile 'com.android.support:palette-v7:23.0.1' compile files('libs/gson-2.4.jar') //Android annotations編譯jar包路徑 apt "org.androidannotations:androidannotations:$AAVersion" compile "org.androidannotations:androidannotations-api:$AAVersion" compile project(':lvcheapplib') //compile "org.apache.httpcomponents:httpcore:4.3.2" } //Android annotations apt { arguments { //老版本的寫法2.2.1以前 //androidManifestFile variant.processResources.manifestFile //2.2.1以後 androidManifestFile variant.outputs[0].processResources.manifestFile resourcePackageName 'com.lvche.lvchedingdang'//專案包名 } }