Search code examples
androiddockergitlab-cigradlew

Gradlew build fails, Android studio succeeds


Trying my best not to bother android developers. I've checked out one branch to setup CI/CD pipeline in Gitlab so I can build APK from the source code.

The app is building fine using Android Studio, but fails when building with gradlew inside docker.

First error was:

: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 {

After I've set exportSchema = false And came to another error

: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);

This is where I am stuck and trying to research as more as I can before "enforce" them to help.

Any advice welcome.


Solution

  • While checking the code, I realised that there were two different UserRepository.java classes located in different packages and using different methods.

    After importing the right one, the problem was solved.