BeeHome从2.3迁移到3.0需要修改的地方



Error:android-apt plugin is incompatible with the Android Gradle plugin.  Please use 'annotationProcessor' configuration instead.

After upgrading from 2.2 to 2.3 I see this warning

enter image description here

and when I try to compile the project I see this compilation error

enter image description here

How can i solve this issue without downgrading to a previous gradle version? Is there any update of android-apt that can solve this issue?


解决方案

After upgrading from 2.2 to 2.3 I see this warning

enter image description here

and when I try to compile the project I see this compilation error

enter image description here

How can i solve this issue without downgrading to a previous gradle version? Is there any update of android-apt that can solve this issue?


The android-apt plugin has been deprecated.
Check here for the migration guide:

As of the Android Gradle plugin version 2.2, all functionality that was previously provided by android-apt is now available in the Android plugin.

You can remove android-apt by following the migration guide to get the equivalent functionalities.

The important parts from the migration guide:

  • Make sure you are on the Android Gradle 2.2 plugin or newer.
  • Remove the android-apt plugin from your build scripts
  • Change all aptandroidTestApt and testApt dependencies to their new format:
dependencies {
   compile 'com.google.dagger:dagger:2.0'
   annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
}

Also in the Android Gradle plugin there is an explicit check for this, which is what you are seeing:

using incompatible plugins for the annotation processing android-apt

Future Android Gradle plugin versions will not be compatible with the way android-aptworks, which is the reason for that check.


After upgrading from 2.2 to 2.3 I see this warning

enter image description here

and when I try to compile the project I see this compilation error

enter image description here

How can i solve this issue without downgrading to a previous gradle version? Is there any update of android-apt that can solve this issue?



2  Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

If you don't really need the mechanism, just specify a random flavor dimension:

android { 
    ...
    flavorDimensions "default"
    ...
}

For more information, check the migration guide


3.  Android Studio 3.0 Compile Issue (Cannot choose between Configurations)

Issue with latest 3.0 build (Beta 2) My project has 1 sub module by a 3rd party so I only have access to their build.gradle.

My project has 3 flavours, snap, uat, production. Each has 2 build types, debug and release. When I try build I get this.

Error:Cannot choose between the following configurations of project :lp_messaging_sdk:
  - debugApiElements
  - debugRuntimeElements
  - releaseApiElements
  - releaseRuntimeElements
All of them match the consumer attributes:
  - Configuration 'debugApiElements':
      - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
      - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
      - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
      - Found org.gradle.api.attributes.Usage 'java-api' but wasn't required.
  - Configuration 'debugRuntimeElements':
      - Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
      - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
      - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
      - Found org.gradle.api.attributes.Usage 'java-runtime' but wasn't required.
  - Configuration 'releaseApiElements':
      - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
      - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
      - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
      - Found org.gradle.api.attributes.Usage 'java-api' but wasn't required.
  - Configuration 'releaseRuntimeElements':
      - Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
      - Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
      - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
      - Found org.gradle.api.attributes.Usage 'java-runtime' but wasn't required.
解决方案
dependencies {
  // If the library configures multiple build variants using product flavors,
  // you must target one of the library's variants using its full configuration name.
compile project(':lp_messaging_sdk')
改为 demoDebugCompile project(path: ':lp_messaging_sdk', configuration: 'demoDebug') fullReleaseCompile project(path: ':lp_messaging_sdk', configuration: 'fullRelease') ...}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值