1.版本问题,src目录下的build.gradle中的
apply plugin: 'com.android.application'
android {
compileSdkVersion 25 // 这一块要和下面的compile 'com.android.support:appcompat-v7 版本对应
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.tubei.warnserver"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1' // 和上面的compileSdkVersion 25 对应
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
testCompile 'junit:junit:4.12'
compile files('libs/tencent_map_sdk_4.0.0.4d9a790.jar')
compile files('libs/TencentLocationSDK_v5.0.1_r251203_170116_1729.jar')
compile files('libs/jcore-android-1.1.6.jar')
compile files('libs/jpush-android-3.0.8.jar')
}
as的sdk不用混用eclipse中的sdk,否则会引起版本混乱。as直接用as官网上的sdk即可。
2.so文件目录问题,eclipse中的so文件放在libs/jniLibs目录下,as中的so文件放在src/main/jniLibs/armeabi-v7a目录下(注意:以目前Android系统版本来看,设置成
armeabi-v7a应给可以适配99%的Android系统。)
3.极光推送要注意在AndroidManifest.xml中加上
<!-- Required -->
<permission
android:name="com.tubei.warnserver.permission.JPUSH_MESSAGE"
android:protectionLevel="signature" />
否则app的极光id无法注册到服务器,推送会报1011错误。