您的位置:首页 > 其它

极光和百度的so文件导入,确保不会报错的方法

2016-05-26 19:18 337 查看
两个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'//项目包名
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: