• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps (Resolved) Unable to run app on Philips TV (ClassNotFoundException)

Hi!

Recently came across a problem that I'm unable to fix. I developed application for Android TV, for development I used Nvidia shield device, everything worked as expected. Then I uploaded the apk to google play for beta testing but when installing this application on Philips Android TV (API version 22), it crashes with the the following exception:

Code:
java.lang.RuntimeException: Unable to instantiate application lv.app.id.App: java.lang.ClassNotFoundException: Didn't find class "lv.app.id.App" on path: DexPathList[[zip file "/data/app/lv.app.id-1/base.apk"],nativeLibraryDirectories=[/data/app/lv.app.id-1/lib/arm, /vendor/lib, /system/lib]]
	at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4530)
	at android.app.ActivityThread.access$1500(ActivityThread.java:151)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5258)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.ClassNotFoundException: Didn't find class "lv.app.id.App" on path: DexPathList[[zip file "/data/app/lv.app.id-1/base.apk"],nativeLibraryDirectories=[/data/app/lv.app.id-1/lib/arm, /vendor/lib, /system/lib]]
	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
	at android.app.Instrumentation.newApplication(Instrumentation.java:980)
	at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
	... 10 more
	Suppressed: java.lang.ClassNotFoundException: lv.app.id.App
		at java.lang.Class.classForName(Native Method)
		at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
		at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
		at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
		... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Installing the same application from google play on Nvidia shield device, it works without any problems. Is there any solution to this? Things I tried so far:

* Checking AndroidManifest.xml file for possible errors
* Checking graddle build options for possible duplicate libraries
* Disabling/Enabling multiDex support

Does anyone have any ideas how to fix this?
Also the philips TV that is used for testing does not have ability to connect it to the pc and use it for debbuging.
 
A couple of questions -

What is lv.app.id.App? Is that class part of your application?
Do any other apps install on this device? Have you tried a very simple 'hello world' app?

lv.app.id was changed for security purposes, but yes, the class is part of the application. I'm pretty sure that there is something wrong with te multidex compilation.

I managed to fix this issue by updating my graddle settings file. Added the following code in the android {} section:
Code:
dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = false
 }

and at the end of this file added
Code:
afterEvaluate {
    tasks.matching {
        it.name.startsWith('dex')
    }.each { dx ->
        if (dx.additionalParameters == null) {
            dx.additionalParameters = []
        }
        dx.additionalParameters += '--multi-dex'
        dx.additionalParameters += "--main-dex-list=$projectDir/multidex.keep".toString()
    }
}
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones