首页 > 解决方案 > Gradlew 构建失败,Android Studio 成功

问题描述

尽量不打扰安卓开发者。我已经检查了一个分支以在 Gitlab 中设置 CI/CD 管道,因此我可以从源代码构建 APK。

该应用程序使用 Android Studio 构建良好,但在使用gradlew内部 docker 构建时失败。

第一个错误是:

:app:compileDebugJavaWithJavacwarning: Supported source version 'RELEASE_7' from annotation processor 'android.arch.persistence.room.RoomProcessor' less than -source '1.8'
/builds/root/android-build/app/src/main/java/rs/project/ssam/drive/database/AppDatabase.java:17: warning: Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide `room.schemaLocation` annotation processor argument OR set exportSchema to false.
public abstract class AppDatabase extends RoomDatabase {

在我设置之后exportSchema = false 又遇到了另一个错误

:app:compileDebugJavaWithJavac/builds/root/android-build/app/src/main/java/rs/project/ssam/drive/api/repository/UserRepository.java:25: error: no suitable method found for injectInto(rs.project.ssam.drive.api.repository.UserRepository)
        App.getInstance().getComponent().injectInto(this);

这就是我陷入困境并试图在“强制”他们提供帮助之前尽可能多地研究的地方。

欢迎任何建议。

标签: androiddockergitlab-cigradlew

解决方案


在检查代码时,我意识到有两个不同的UserRepository.java类位于不同的包中并使用不同的方法。

导入正确的后,问题就解决了。


推荐阅读