I've moved from Mac to a linux machine (ubuntu) and and can't get the previous project running. The project has about 10 modules, and it still works fine on my macbook, but when building on ubuntu (tried clean install on 17.10 2 times, and 16.04 2 times as well) will crash the app on start with the following error:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate application com.xxx.xxx.Application: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxx.Application" on path: DexPathList[[zip file "/data/app/com.xxx.xxx.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.xxx.debug-1/lib/arm, /data/app/com.xxx.xxx.debug-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:802)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5418)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1558)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxx.Application" on path: DexPathList[[zip file "/data/app/com.xxx.xxx.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.xxx.debug-1/lib/arm, /data/app/com.xxx.xxx.debug-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newApplication(Instrumentation.java:1014)
at android.app.LoadedApk.makeApplication(LoadedApk.java:796)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5418)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1558)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
I've tried cleaning, rebuilding, invalidating and restarting, 3 different android studio versions (the stable one, 2.3, and latest canary build) on both operating systems (17.10 and 16.04) and I still get exactly same error. Also, I've installed the libraries for 64 bit system. Also, I've tried with oracle java as well.
Does anyone have any clue why a project gets this error on linux but not on mac?
Update
So I found out that Ubuntu does not see the application class. It has a red label and is not recognized from the manifest file. This is the application class from app
package and I can only see it if I switch to project view. I'm currently investigating why it doesn't see it.