android-annotation:错误:找不到符号

时间:2019-07-02 07:28:40

标签: android-gradle android-annotations

在app / build.gradle中:

def AAVersion = '4.5.2'

dependencies {
    annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"  
implementation "com.googlecode.androidannotations:androidannotations-api:2.7.1"

在gradle.properties中:

android.enableSeparateAnnotationProcessing=true

在我的片段中:

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.googlecode.androidannotations.annotations.Background;
import com.googlecode.androidannotations.annotations.EFragment;
import com.googlecode.androidannotations.annotations.UiThread;

@EFragment
public class SelectAgentMainFragment extends WZRootFragment
        implements FragmentPagerPageSelectedListener, Serializable, LocationAware {
public static final String IS_HIDE_MAP_TAB = SelectAgentMainFragment_.class.getName() + "_IS_HIDE_MAP_TAB";

但是我得到了编译错误:

   > Task :mymodule1:compileDebugJavaWithJavac FAILED
Gradle may disable incremental compilation as the following annotation processors are not incremental: androidannotations-4.5.2.jar (org.androidannotations:androidannotations:4.5.2).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental.
mymodule1\src\main\java\android\agents\SelectAgentMainFragment.java:57: error: cannot find symbol
    public static final String IS_HIDE_MAP_TAB = SelectAgentMainFragment_.class.getName() + "_IS_HIDE_MAP_TAB";


                                                 ^
  symbol:   class SelectAgentMainFragment_
  location: class SelectAgentMainFragment

P.S。

WARNING: The option setting 'android.enableSeparateAnnotationProcessing=true' is experimental and unsupported.
The current default is 'false'.

1 个答案:

答案 0 :(得分:0)

此代码似乎有问题。

AbstractModel

将其更改为

public static final String IS_HIDE_MAP_TAB = SelectAgentMainFragment_.class.getName() + "_IS_HIDE_MAP_TAB";