I see quite a number of crashes of my Android application with an android.view.InflateException. Unfortunately, it does not happen on my device or simulators and the error is telling me nothing. I am assuming it works for most of the devices, the error is mostly occuring in Android 4.x and rarely on 5.
Could any of you help me? That would be great!
It seems to happen when the users open up my preference activity. Here is the stacktrace:
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2413)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
at android.app.ActivityThread.access$900(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invokeNative(Native Method:0)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method:0)
Caused by: android.view.InflateException:
at android.preference.GenericInflater.createItem(GenericInflater.java:397)
at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
at android.preference.GenericInflater.inflate(GenericInflater.java:326)
at android.preference.GenericInflater.inflate(GenericInflater.java:263)
at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)
at android.preference.PreferenceFragment.addPreferencesFromResource(PreferenceFragment.java:315)
at bloggersoft.sudokuoftheday.EinstellungenActivity$MyPreferenceFragment.onCreate(EinstellungenActivity.java:305)
at android.app.Fragment.performCreate(Fragment.java:1678)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:859)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
at android.app.BackStackRecord.run(BackStackRecord.java:684)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1453)
at android.app.Activity.performStart(Activity.java:5467)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2386)
I have to apologize. The code I posted was the full output from the developer console stacktrace and did not help me as well, upon testing it in the right emulator the error was shown: I forgot to set a default value for a MultiSelectList preference. This fixed it.
Related
I know this question may be duplicate but I have tried many solutions but I am unable to make my app work. It should be noted that I have enabled Multidex but still getting below error. I am creating a react native app.
FATAL EXCEPTION: main
Process: com.xxxxxx.yyyyyyyy, PID: 3978
java.lang.NoClassDefFoundError: com.google.android.gms.common.internal.zzbo
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5049)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4623)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
If you are developing a react native application and above error came , just make sure that all of your dependencies's Gradle are using same version of firebase servces and play service base.
For example :- my app level gradle file contains
compile "com.google.android.gms:play-services-base:11.4.0"
compile "com.google.firebase:firebase-core:11.4.0"
compile "com.google.firebase:firebase-messaging:11.4.0"
compile "com.google.firebase:firebase-analytics:11.4.0"
compile "com.google.firebase:firebase-crash:11.4.0"
compile "com.google.firebase:firebase-ads:11.4.0"
and one react-native library is using
compile "com.google.android.gms:play-services-base:11.8.0"
and other one library is using
compile "com.google.android.gms:play-services-base:+"
so what i did , i changed all services version to 11.8.0.
BTW you can see gradles of all libraries or dependencies when you open your react-native-project/android folder in Android studio
I hope this will solve your issue
Hi i am using UsageStatsManager api to show some usage list to user. But i am facing some issue. i am getting this error in many device, in some device it's working fine. i am still surfing about this issue. can you guys please help me to solve this.
Error:
java.lang.NoClassDefFoundError: android.app.usage.UsageStatsManager
at com.yourapp.fragment.AppUsageStatisticsFragment.onViewCreated(AppUsageStatisticsFragment.java:64)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:800)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5463)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:854)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:621)
at dalvik.system.NativeStart.main(Native Method)
Code i have used:
private UsageStatsManager mUsageStatsManager;
//i am getting error at below line.
mUsageStatsManager = (UsageStatsManager) getActivity()
.getSystemService("usagestats"); //Context.USAGE_STATS_SERVICE
Manifest:
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions"/>
Check my app.
UsageStatsManager Added in API level 21 this is not a part of your appcompact API. So that's why before API level 21 you will get the ClassNotFoundException
UsageStatsManager was Added in API level 21 so you will get this ClassNotFoundException on preLollipop.
Also some samsung and other devices throws ClassNotFoundException on lollipop too as they haven't included that class, You can only safely use the class in API 22
When I install my app on my device through Android Studio, everything is ok, but when I close the app, and try to reopen it, the app crash. I have also tried to do a new project with the same project but everytime I obtain the same problem. I don't use a complicated code but don't knwow why this happens.
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 9223212 byte allocation with 5451732 free bytes and 5MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:741)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:562)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1014)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:3702)
at android.content.res.Resources.loadDrawable(Resources.java:3575)
at android.content.res.TypedArray.getDrawable(TypedArray.java:750)
at com.blunderer.materialdesignlibrary.views.CardView.<init>(CardView.java:58)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:130)
at it.quotidianiitaliani.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:6221)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2723)
at android.app.ActivityThread.access$900(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5832)
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:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
OutOfMemoryError is the most common problem occur in android while especially dealing with bitmaps. This error is thrown by the Java Virtual Machine (JVM) when an object cannot be allocated due to lack of memory space and also, the garbage collector cannot free some space.
I think you should read some at Androids Developer page, specially here:
http://developer.android.com/training/displaying-bitmaps/index.html
Was running my Android app on a 5.1.1 device (Nexus 9) when I got a sudden, strange crash. The process seemed to die when the app was trying to start a new activity (startActivityForResult() to be specific). I went to check out the logcat (no exception was thrown in the debugger) and saw this:
E/ActivityThread(13750): Performing stop of activity that is not resumed: {com.android.settings/com.android.settings.SubSettings}
E/ActivityThread(13750): java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.android.settings/com.android.settings.SubSettings}
E/ActivityThread(13750): at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3344)
E/ActivityThread(13750): at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3425)
E/ActivityThread(13750): at android.app.ActivityThread.access$1100(ActivityThread.java:151)
E/ActivityThread(13750): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1332)
E/ActivityThread(13750): at android.os.Handler.dispatchMessage(Handler.java:102)
E/ActivityThread(13750): at android.os.Looper.loop(Looper.java:135)
E/ActivityThread(13750): at android.app.ActivityThread.main(ActivityThread.java:5254)
E/ActivityThread(13750): at java.lang.reflect.Method.invoke(Native Method)
E/ActivityThread(13750): at java.lang.reflect.Method.invoke(Method.java:372)
E/ActivityThread(13750): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/ActivityThread(13750): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
I thought it was odd that the exception is calling out the native settings app rather than my own since it decided to kill my process. Is this normal/is there something I can do to stop exceptions from a native app wiping out my process? Or perhaps am I misreading the exception entirely?
I want to setTypeFace from url like : https://github.com/anak10thn/frontend-homepage/raw/master/font/helvetica-regular.otf
Do you know if there any way ?
I tried this :
Typeface tf = Typeface.createFromFile("https://github.com/anak10thn/frontend-homepage/raw/master/font/helvetica-regular.otf");
tv.setTypeface(tf);
It doesn't work.
I have this error :
03-24 04:46:59.931 1314-1314/bya.fchps.buildyourapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: bya.fchps.buildyourapp, PID: 1314
java.lang.RuntimeException: Unable to start activity ComponentInfo{bya.fchps.buildyourapp/com.fchps.buildyourapp.views.ClassicView}: java.lang.RuntimeException: native typeface cannot be made
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: native typeface cannot be made
at android.graphics.Typeface.<init>(Typeface.java:175)
at android.graphics.Typeface.createFromFile(Typeface.java:159)
at com.fchps.buildyourapp.views.ClassicView.setClassicLabel(ClassicView.java:178)
at com.fchps.buildyourapp.views.ClassicView.onCreate(ClassicView.java:75)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
Hi You can not directly add the URL of font in Typeface. If you want to dynamically use the font in your application, the best option is application would download fist font in local device. Then define the path of font in to the Typeface.
Typeface typeface = Typeface.createFromFile(
new File(Environment.getExternalStorageDirectory(), "font.ttf"));
I dont believe you can actually. The custom typeface is usually kept as a system resource file, and not referred to as a web document. As far as i know, the best method would most likely be: Create a fonts folder in your assets folder. Download the font you desire and place it in the fonts folder, and then in the code refer back to your fonts folder. For further detailed instructions refer to this website: http://www.tutorialspoint.com/android/android_custom_fonts.htm