gpt4 book ai didi

AndroidAnnotations + Instant App - 找不到生成的 .R 类

转载 作者:行者123 更新时间:2023-11-29 23:29:10 24 4
gpt4 key购买 nike

我目前正在使用 android-topeka 开发 Android 即时应用程序示例项目。

在我使用 AndroidAnnotations 之后,一切都按预期工作关于我的 Activity :

@EActivity(resName = "activity_start")
public class StartActivity extends AppCompatActivity {
...
}

如果我想启动应用程序(:installed),一切正常,但对于instant-app( :instant),我收到以下错误:

:base:javaPreCompileDebugFeature UP-TO-DATE
error: The generated <applicationId>.R class cannot be found
1 error
:base:compileDebugFeatureJavaWithJavac FAILED

附加信息:

If I remove the application project(':installed') in the base build.gradle I can start the instant-app but with the wrong application-id (configured in the :installed project).

最佳答案

在这个 issue 的帮助下,我终于明白了跟踪器(感谢 Kay-Uwe Janssen)。也感谢杰斯。总的来说,它是结合了 Manifest Finder 和 annotationProcessorOptions 的设置。

这是我的 gradle/Manifest 设置的样子:

基地:

build.gradle:

android {
...

baseFeature true

defaultConfig {
...

javaCompileOptions {
annotationProcessorOptions {
arguments = ["resourcePackageName": "com.test.base"]
}
}
}

buildTypes {
release {
}
}
}
dependencies {
application project(':installed')
...
}

AndroidManifest.xml:

<manifest ...
package="com.test.base">
...
</manifest>

已安装:

build.gradle:

android {
...
}

dependencies {
implementation project(':base')
}

AndroidManifest.xml:

<manifest package="com.test2">
</manifest>

即时:

build.gradle:

android {
defaultConfig {}
}

dependencies {
implementation project(':base')
}

With this setup, the Instant App has the same App-Id as the Installed one "com.test2"

关于AndroidAnnotations + Instant App - 找不到生成的 <applicationId>.R 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52972693/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com