https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
j

juliocbcotta

03/06/2019, 12:59 AM
Hi, I am trying to update a project from the old format for mpp projects to the current format, but I stuck with a problem when running the android app... it seems that the Activity is not found in the main dex...
Copy code
2019-03-05 21:46:22.422 25541-25541/br.com.youse.forms.app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: <http://br.com.youse.forms.app|br.com.youse.forms.app>, PID: 25541
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{<http://br.com.youse.forms.app/br.com.youse.forms.samples.form.FormLoginActivity|br.com.youse.forms.app/br.com.youse.forms.samples.form.FormLoginActivity>}: java.lang.ClassNotFoundException: Didn't find class "br.com.youse.forms.samples.form.FormLoginActivity" on path: DexPathList[[zip file "/data/app/br.com.youse.forms.app-B2ycXZrm8-D79TrXtKX7Iw==/base.apk"],nativeLibraryDirectories=[/data/app/br.com.youse.forms.app-B2ycXZrm8-D79TrXtKX7Iw==/lib/x86, /system/lib, /vendor/lib]]
...
     Caused by: java.lang.ClassNotFoundException: Didn't find class "br.com.youse.forms.samples.form.FormLoginActivity" on path: DexPathList[[zip file "/data/app/br.com.youse.forms.app-B2ycXZrm8-
I did check if the Activity in the AndroidManifest is right and I could run the same
:app
code switching the local mpp project to a published dep. I also can ran the unit tests from commonTest just fine. Does anyone has ran into something like that? I uploaded my current work here https://github.com/BugsBunnyBR/forms-mpp-problem if anyone want to take a look...
j

josephivie

03/06/2019, 7:16 PM
I've never had a similar issue, and I've been doing some Android-specific MPP stuff. I imaging you've already tried cleaning and rebuilding?
j

juliocbcotta

03/06/2019, 7:40 PM
Yes, I did. I even upgraded my AGP to use the 3.4.0 beta..
The project has no secret, but I fail to understand why it compiles and fails at runtime.
j

josephivie

03/07/2019, 2:14 AM
Idea: try compiling it to an AAR using
com.android.library
instead. Then, open said AAR and see if you can find your .class file. That might give a start into figuring out what's up.
j

juliocbcotta

03/07/2019, 5:00 AM
After hours looking at other projects I found the culprit. I was missing
Copy code
kotlin {
    targets.fromPreset(presets.android, 'android')
}
in the
:app
module