1
votes

I'm getting the following error:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com..chat/com..login.LoginActivity}: java.lang.ClassNotFoundException: Didn't find class "com..login.LoginActivity" on path: DexPathList[[zip file "/data/app/com..chat-1/base.apk"],nativeLibraryDirectories=[/data/app/com.*.chat-1/lib/arm, /vendor/lib, /system/lib]]

I have tried everything I could find online without success. The only way I could get around this by this inefficient script I made:

#!/usr/bin/env bash

./gradlew app:clean
./gradlew app:installDebug
./gradlew app:clean
./gradlew app:installDebug

/home/adel/Android/Sdk/platform-tools/adb shell am start -n com.*.chat/com.*.login.LoginActivity

notify-send -i icon.png "gradle task done" "check your phone"

It works, but takes around 7 minutes to get done. Is there a faster, more efficient way of doing this?

2
why are you invoking same things twice? why the wildcards? - Diego Torres Milano
@DiegoTorresMilano I'm not sure why but if I build once I get "ClassNotFoundException" exception, I found out invoking same things twice fix this problem ... wild card because I don't want people googling app name to find this question - netdur
So, fix the ClassNotFoundException problem first. And how are people looking at this question to give you an answer supposed to guess that you are hiding the package with wildcard? - Diego Torres Milano
Yeah if you notice the question is about ClassNotFoundException problem I need to fix, building the project twice without any modifications makes the problem vanish, go figure! - netdur

2 Answers

1
votes

Use just this:

./gradlew --offline clean assembleDebug

To send .apk to your device use something like that:

adb install app/build/output/apk/appDebug.apk

Ensure your apk filename and the path are correct.

0
votes

I have stopped the Instant run from Android studio and its working.

File->Setting->Build->Instant Run->Disble checkbox of Enable instant run to hotswap code/resource changes