Issue: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity

Hello Everyone,

I uploaded my mit app inventor app (SILA) it’s weird that I had that issue can you help me in fixing it what should I do ?

Issue: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

Hello Ammar

I think we need to see your Blocks :face_with_raised_eyebrow:

1 Like

Are you using extensions? If so, an activity in the extension may be extending AppCompatActivity rather than AppInventorActivity (which has logic to deal with the Theme property). Another possibility is that the extension exposes some functionality in the app compat library but since the Theme is set to classic it fails when compiled as not everything is included with the Classic theme. Are you able to reproduce this on your own device? If so, the output from an adb logcat would go a long way to helping identify where the issue is originating.

1 Like

More of error log it in attached logcat file.logcat_2.txt (3.9 MB) , thanks in advance for your help.

Build: samsung/m0xx/m0:4.3/JSS15J/I9300XXUGMK6:user/release-keys
Hardware: smdk4x12
Revision: 12
Bootloader: I9300XXUGNA5
Radio: unknown
Kernel: Linux version 3.0.31-2191747 (dpi@DELL136) (gcc version 4.4.3 (GCC) ) #1 SMP PREEMPT Tue Nov 26 16:57:12 KST 2013
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/m0xx/m0:4.3/JSS15J/I9300XXUGMK6:user/release-keys'
Revision: '12'
pid: 14922, tid: 14922, name: android.vending  >>> com.android.vending <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
    r0 00000000  r1 00000000  r2 00000000  r3 40b7f1a0
    r4 42c20928  r5 00000000  r6 00000000  r7 00000000
    r8 594ff000  r9 00000007  sl 57defac8  fp be956064
    ip 00000003  sp be955e98  lr 40b0d859  pc 40b187d8  cpsr 60000030
    d0  000000000000000f  d1  0000000000000000
    d2  ffffffffffffffff  d3  ffffffffffffffff
    d4  8000000000000000  d5  3fcef049fb9094d1
    d6  3f00000000000000  d7  3f8000003f4ccccd
    d8  0000000000000000  d9  0000000000000000
    d10 0000000000000000  d11 0000000000000000
    d12 0000000000000000  d13 0000000000000000
    d14 0000000000000000  d15 0000000000000000
    d16 000000000000001a  d17 0000000000000000
    d18 4146605000000000  d19 0065004e005f0061
    d20 3f8948b0fcd6e9e0  d21 3fe555b0aaeac752
    d22 3fd24998d6307188  d23 3fcc7288e957b53b
    d24 3fc74721cad6b0ed  d25 3fc2f112df3e5244
    d26 40026bb1bbb55516  d27 4000000000000000
    d28 40008df2d49d41f1  d29 3fb0f4a31edab38b
    d30 3ff0000000000000  d31 3f4de16b9c24a98f
    scr 20000010
backtrace:
    #00  pc 0004f7d8  /system/lib/libdvm.so (dvmDescriptorToName(char const*)+3)
    #01  pc 00044855  /system/lib/libdvm.so (dvmThrowChainedExceptionWithClassMessage(ClassObject*, char const*, Object*)+8)
    #02  pc 0006b757  /system/lib/libdvm.so
    #03  pc 000657c5  /system/lib/libdvm.so
    #04  pc 00027860  /system/lib/libdvm.so
    #05  pc 0002be00  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
    #06  pc 00060a6d  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+292)
    #07  pc 00060a97  /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
    #08  pc 0006b859  /system/lib/libdvm.so (dvmFindClassNoInit(char const*, Object*)+112)
    #09  pc 0006c7c1  /system/lib/libdvm.so (dvmResolveClass+48)
    #10  pc 0006a4b9  /system/lib/libdvm.so (dvmLinkClass(ClassObject*)+212)
    #11  pc 0006b655  /system/lib/libdvm.so
    #12  pc 000657c5  /system/lib/libdvm.so
    #13  pc 00027860  /system/lib/libdvm.so
    #14  pc 0002be00  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
    #15  pc 00060a6d  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+292)
    #16  pc 00060a97  /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
    #17  pc 0006b859  /system/lib/libdvm.so (dvmFindClassNoInit(char const*, Object*)+112)
    #18  pc 0005da99  /system/lib/libdvm.so (dvmOptResolveClass(ClassObject*, unsigned int, VerifyError*)+44)
    #19  pc 0005ddc5  /system/lib/libdvm.so (dvmOptResolveMethod(ClassObject*, unsigned int, MethodType, VerifyError*)+52)
    #20  pc 0005e247  /system/lib/libdvm.so
    #21  pc 0005e457  /system/lib/libdvm.so (dvmOptimizeClass(ClassObject*, bool)+46)
    #22  pc 0006ba4f  /system/lib/libdvm.so (dvmInitClass+174)
    #23  pc 0006bc0d  /system/lib/libdvm.so (dvmInitClass+620)
    #24  pc 0002275c  /system/lib/libdvm.so
    #25  pc 0002be00  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
    #26  pc 00060d2b  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+350)
    #27  pc 000689ab  /system/lib/libdvm.so
    #28  pc 00027860  /system/lib/libdvm.so
    #29  pc 0002be00  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
    #30  pc 00060a6d  /system/lib/libdvm.so (dvmCallMethodV(Thread*, M
processName:com.android.vending
broadcastEvent : com.android.vending SYSTEM_TOMBSTONE

Hello Amar

Having two Forum Topics on the same subject was not a good idea! We missed the upload of your Log Cat file, which is littered with issues.

I think we need to see your Project File (.aia).

this seems to be the relevant part of the logcat output

01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): Encountered uncaught exception.
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at aai.p(PG:106)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at aai.b(PG:79)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at aaw.setContentView(PG:11)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at aae.onCreate(PG:20)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at android.app.Dialog.dispatchOnCreate(Dialog.java:362)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at android.app.Dialog.show(Dialog.java:266)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at ma.f(PG:85)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at rbz.f(PG:23)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at mo.a(PG:304)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at mo.c(PG:553)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at mo.a(PG:613)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at lw.g(PG:112)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at mo.a(PG:854)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at mo.b(PG:803)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at mo.k(PG:772)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at mp.run(PG:2)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at android.os.Handler.handleCallback(Handler.java:730)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at android.os.Handler.dispatchMessage(Handler.java:92)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at android.os.Looper.loop(Looper.java:176)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at android.app.ActivityThread.main(ActivityThread.java:5419)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at java.lang.reflect.Method.invokeNative(Native Method)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at java.lang.reflect.Method.invoke(Method.java:525)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
01-22 01:38:10.127: E/UncaughtExceptionHandle(15715): 	at dalvik.system.NativeStart.main(Native Method)
01-22 01:38:10.157: I/dalvikvm(15755): Could not find method android.app.ActivityManager.isLowRamDevice, referenced from method am.a

you forgot to answer this question

so which extensions are you using?
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

The logcat output highlighted by @Taifun does point to the potential issue in the sense that App Inventor does not use proguard, so the fact that the names are minimized/obfuscated means that the extension developer went through the trouble of running proguard on it, or uses a library that has used proguard. Unfortunately, I can’t really help you debug obfuscated code. The easiest solution would be to change your Screen1’s Theme property to Device Default as that will have the greatest chance of alleviating the problem.