Android studio 2 版本升级 Android studio 3 版本注意事项

 

1. compile 需要改成 implementation 或者 api
例:implementation 'com.android.support:support-v4:23.4.0'
详细规则 https://blog.youkuaiyun.com/yuzhiqiang_1993/article/details/78366985

2. apt 需要去掉,改成 annotationProcessor
例:annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.0.1'

3. 多渠道需要这样配置:

例:
defaultConfig {
  applicationId "com.roadrover.bluetooth"
  minSdkVersion 23
  targetSdkVersion 25
  versionName "2.1.4"
  versionCode 214

  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 9
  targetSdkVersion 19

  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

转载于:https://www.cnblogs.com/lipeineng/p/10648609.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值