androidannotations 4.0.0 不显示布局

标签 android android-layout android-annotations

我在 Android Studio 中使用 androidannotations 4.0.0,

我的代码是这样的:

@EActivity(resName = "activity_demo_web_sdk")
public class DemoWebSdkActivity extends AppCompatActivity {
    String TAG="DemoWebSdkActivity";
}

运行这段代码后,我看不到布局,但是如果我使用 setContentView 而不是 androidannotations,它会运行良好。

我的gradle如下:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        // replace with the current version of the Android plugin
        classpath 'com.android.tools.build:gradle:1.5.0'
        // replace with the current version of the android-apt plugin
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

apply plugin: 'android-apt'
def AAVersion = '4.0.0'
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
}
apt {
    arguments {
        androidManifestFile variant.outputs[0]?.processResources?.manifestFile
        library true
        // if you have multiple outputs (when using splits), you may want to have other index than 0

        // you should set your package name here if you are using different application IDs
        // resourcePackageName "your.package.name"

        // You can set optional annotation processing options here, like these commented options:
        // logLevel 'INFO'
        // logFile '/var/log/aa.log'
    }
}

有谁知道,为什么会这样?

我注意到有些人遇到了同样的情况 problem ,但没有解决答案。

需要帮助。

最佳答案

肯定有一个问题。您应该在处理参数中使用字符串:

library "true"

此外,请确保在 list 中使用生成的类 DemoWebSdkActivity_,并启动该类。

关于androidannotations 4.0.0 不显示布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36874288/

相关文章:

php - 检测用户平台

android - 为什么应用程序突然与某些设备不兼容?

android - 自动从依赖项添加存储库

android - RestrictTo 不限制受限方法的使用

Android注解不知道textview

java - 如何检查日历/日期对象中的特定变量是否与java匹配?

Android如何定位绿色圆圈图像?

Android:给所有的 View 都赋予id有什么好处吗?

android - 如何最大化 Android 小部件尺寸(宽度)?

Android 注释 gradle 警告