Android Question Crash at startup: java.lang.NoSuchFieldError:

Dave61

Member
Licensed User
Longtime User
I loaded up my B4A application source code after not working on it for some time and just updating B4A 5.50 to 5.80 this evening.
When I load it over to my phone I get a crash that looks like this in the Logs:

java.lang.NoSuchFieldError: No static field Theme of type [I in class Landroid/support/v7/appcompat/R$styleable; or its superclasses (declaration of 'android.support.v7.appcompat.R$styleable' appears in /data/app/example.tablayout.customtabs-1/base.apk)
at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:306)
at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:279)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:244)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:114)
at example.tablayout.customtabs.main.onCreate(main.java:59)
at android.app.Activity.performCreate(Activity.java:6550)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3108)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3263)
at android.app.ActivityThread.access$1000(ActivityThread.java:197)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1687)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6897)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

The application itself just crashes with "Unfortunately, My Budget has stopped". I am not really sure what to do about this as I don't really know what goes on in the background of B4A. I have a log statement at the start of my B4A app like this:

Sub Activity_Create(FirstTime As Boolean)
Log("Main.Activity_Create(): Started")

but it doesn't appear to be getting even that far. Is there anything in the debug information above that can help me narrow this down? I see mention of "AppCompat" which I am using as a library but I have version 2.0 which appears to be the newest. I haven't made any code changes at all since it was last working.
 

DonManfred

Expert
Licensed User
Longtime User
Without seeing your code it is hard to give advices.
I Guess you are missing #AdditionalRes commands
or you app is not corectly setup to be used with appcompat.
 
Upvote 0

Dave61

Member
Licensed User
Longtime User
Ah, ok - I will poke around there. I haven't changed any code so not sure how that could have gotten messed up. But I have updated B4A and also Android Studio to the latest versions.

My main module has this at the top:

#AdditionalRes: ..\resource
#AdditionalRes: C:\Users\Dave61\Dropbox\Personal\B4A\AdditionalLibraries\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: C:\Users\Dave61\Dropbox\Personal\B4A\AdditionalLibraries\b4a_floatingactionbutton, de.amberhome.objects.floatingactionbutton
#AdditionalRes: C:\Android\sdk1\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
#AdditionalRes: C:\Android\sdk1\extras\android\support\design\res, android.support.design
#Extends: android.support.v7.app.AppCompatActivity

and I checked that all the folders mentioned there do actually exist....though I am not sure what the last parameter on each line means in regard to the directory. There is no file called de.amberhome.objects.appcompat in the C:\Users\Dave61\Dropbox\Personal\B4A\AdditionalLibraries\b4a_appcompat directory for example, just a Layout directory with 5 xml files.
 
Upvote 0
Top