1. compile 需要改成 implementation 或者 api
例:implementation 'com.android.support:support-v4:23.4.0'
详细规则 https://blog.csdn.net/yuzhiqiang_1993/article/details/78366985
2. apt 需要去掉,改成 annotationProcessor
例:annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.0.1'
3. 多渠道需要这样配置:
例:
defaultConfig {
applicationId "com.roadrover.bluetooth"
minSdkVersion
targetSdkVersion
versionName "2.1.4"
versionCode flavorDimensions "color" // 添加
}
productFlavors {
t3plus {
dimension "color" // 添加
}
imx6 {
dimension "color" // 添加
}
imx6_yutong17a {
dimension "color" // 添加
}
}
4. NDK暂时不要升级最新版本,会影响编译
5. Could not find com.android.tools.lint:lint-gradle:xxxx : allprojects模块的repositories中缺少了google()
例:allprojects {
repositories {
jcenter()
google()
}
}
6. error: style attribute ‘@android:attr/windowEnterAnimation’ not found.
修改前
<style name="remnote_play_time_animation">
<item name="@android:windowEnterAnimation">@anim/remote_play_popup_show</item>
<item name="@android:windowExitAnimation">@anim/remote_play_popup_hide</item>
</style>
修改后
<style name="remnote_play_time_animation">
<item name="android:windowEnterAnimation">@anim/remote_play_popup_show</item>
<item name="android:windowExitAnimation">@anim/remote_play_popup_hide</item>
</style>
7.SDK工具版本
app中的gradle中的
compileSdkVersion 27
buildToolsVersion '27.0.3'
gradle中的wrapper中的distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
project中的gradle的classpath 'com.android.tools.build:gradle:3.1.2'
8.EventBus异常
defaultConfig {
minSdkVersion
targetSdkVersion javaCompileOptions { // 添加
annotationProcessorOptions {
arguments = [eventBusIndex: "com.example.myapp.MyEventBusIndex"]
}
}
}
dependencies {
api 'com.android.support:support-v4:27.0.0'
api 'org.greenrobot:eventbus:3.1.1' // 添加
annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.1.1' // 添加
}
9.修改aar文件名字的异常
修改前
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "libvlc.aar"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
修改后
libraryVariants.all { variant ->
variant.outputs.all { output -> // 修改后
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "libvlc.aar"
outputFileName = new File("../../../release/", fileName) // 修改后
}
}
}
10.Android SDK Platform-Tools 版本使用26.0.2