My app runs perfectly when I run it using Android studio.
When I uploaded the app to the playstore, I started getting the following error:
12-19 13:42:14.971 18767-18767/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.djulie.acs.djulie_driver_new, PID: 18767
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.djulie.acs.djulie_driver_new/com.djulie.acs.djulie_driver_new.Menu.MainMenu}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class ImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3255)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3351)
at android.app.ActivityThread.access$1100(ActivityThread.java:222)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1796)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7230)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class ImageView
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at android.support.v7.app.ae.b(Unknown Source)
at android.support.v7.app.p.setContentView(Unknown Source)
at com.djulie.acs.djulie_driver_new.Menu.MainMenu.onCreate(Unknown Source)
I have add this code to the OnCreate event method, but it is still not working
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
thanks in advance for your help.
You have to add AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); like this
public class Login extends AppCompatActivity {
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
//then your onCreate method will be start
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
problem solved by deleting ProGuard
Related
I am using Firebase Test Lab to test my app and i get this error on several devices
This stops one of my activities to launch,
I am an new to android
I do not know how to fix this any help would be appreciated
android.view.InflateException: Binary XML file line #27: Error inflating class TextView
FATAL EXCEPTION: main
Process: com.smartpractice.dukatholesmartapp, PID: 6608
android.view.InflateException: Binary XML file line #27: Error inflating class TextView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.widget.Toast.makeText(Toast.java:262)
at es.dmoral.toasty.Toasty.custom(Toasty.java:300)
at es.dmoral.toasty.Toasty.info(Toasty.java:174)
at es.dmoral.toasty.Toasty.info(Toasty.java:162)
at com.smartpractice.myapplication.SecondActivity$5.onResponse(SecondActivity.java:209)
at com.smartpractice.myapplication.SecondActivity$5.onResponse(SecondActivity.java:206)
at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:82)
at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:29)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:102)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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.ArrayIndexOutOfBoundsException: length=16; index=19
at android.content.res.StringBlock.get(StringBlock.java:65)
at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:458)
at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:991)
at android.content.res.TypedArray.getString(TypedArray.java:176)
at androidx.appcompat.widget.TintTypedArray.getString(TintTypedArray.java:143)
at androidx.appcompat.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:449)
at androidx.appcompat.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:204)
at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:105)
at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:95)
at androidx.appcompat.app.AppCompatViewInflater.createTextView(AppCompatViewInflater.java:182)
at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1407)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1457)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
Here is the line where the error occurs
I am not sure Which line causes the error
* Line 27 from the error
*<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="48dp"
android:fontFamily="#font/nunito"
android:gravity="center_horizontal"
android:text="#string/welcome_to_smartpractice"
android:textSize="24sp"
app:fontFamily="#font/nunito"
app:layout_alignSelf="baseline"
/>
Please check caused by tag in your error log first.
It clearly says java.lang.ArrayIndexOutOfBoundsException.
So I suggest you to reverify your code of SecondActivity.java file near line 209 where you are getting some item from list.
If I have SupportMapFragment then Apply changes button (yellow one) doesn't work with success (app would crash with Error inflating class fragment error)
I have to always press green button to see any changes
at 12 line I have
<fragment android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
Error:
Process: com.example.test, PID: 4940
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test/com.example.test.MainActivity}: android.view.InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2485)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2545)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4189)
at android.app.ActivityThread.access$1200(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1404)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
Caused by: android.view.InflateException: Binary XML file line #12: Binary XML file line #12: Error inflating class fragment
at android.view.LayoutInflater.inflate(LayoutInflater.java:543)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)
at android.app.Activity.setContentView(Activity.java:2233)
at com.example.test.MainActivity.onCreate(MainActivity.java:67)
at android.app.Activity.performCreate(Activity.java:6358)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2438)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2545)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4189)
at android.app.ActivityThread.access$1200(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1404)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
p.s. 'com.google.android.gms:play-services-maps:16.0.0' is used
The one you call it yellow button is for instant run, the crash caused because the MapFragment will not be added the BackStack so when instant run the application it will not find an instance for it. You can Fix it by :
if (savedInstanceState != null) {
mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentByTag("map");
} else {
mapFragment = SupportMapFragment.newInstance();
FragmentTransaction mapTransaction = getSupportFragmentManager().beginTransaction();
mapTransaction.addToBackStack("map").add(R.id.map, mapFragment, "map").commit();
}
mapFragment.getMapAsync(this);
I´ve a weird problem when building my signed App via AndroidStudio.
The app is generated successful, but when I want to start it on my smartphone I get the following error:
FATAL EXCEPTION: main
Process: my.package, PID: 21935
java.lang.RuntimeException: Unable to start activity ComponentInfo{my.package/gui.Main}: android.view.InflateException: Binary XML file line #58: Binary XML file line #58: Error inflating class Button
at android.app.ActivityThread.perfor
mLaunchActivity(ActivityThread.java:2984)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: android.view.InflateException: Binary XML file line #58: Binary XML file line #58: Error inflating class Button
Caused by: android.view.InflateException: Binary XML file line #58: Error inflating class Button
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.ae.a()' on a null object reference
at android.support.v7.widget.ag.setBackgroundDrawable(Unknown Source)
at android.view.View.setBackground(View.java:19498)
at android.view.View.<init>(View.java:4932)
at android.widget.TextView.<init>(TextView.java:1041)
at android.widget.Button.<init>(Button.java:113)
at android.widget.Button.<init>(Button.java:106)
at android.support.v7.widget.ag.<init>(Unknown Source)
at android.support.v7.widget.ag.<init>(Unknown Source)
at android.support.v7.a.au.a(Unknown Source)
at android.support.v7.a.af.a(Unknown Source)
at android.support.v4.g.ad.onCreateView(Unknown Source)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.preference.PreferenceFragment.onCreateView(PreferenceFragment.java:179)
at android.app.Fragment.performCreateView(Fragment.java:2352)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:995)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1171)
at android.app.BackStackRecord.run(BackStackRecord.java:815)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1582)
at android.app.FragmentController.execPendingActions(FragmentController.java:372)
at android.app.Activity.performStart(Activity.java:6971)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2937)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
When I start the app via Debug mode or build a debug APK file, it starts normally.
I see that there is a problem with a button in one Binary XML file in line #58.
But in which file? In the Main class there is only a preference file without any button...
And why does it work in Debug mode?
Any idea?
Thanks!
When I disable proguard it works! :-)
But what is the problem with proguard?
Here is my Grandle file:
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
proguard.cfg:
-ignorewarnings
An user has this crash (it's the first time!). I can't understand why, it's crazy...
This user setup: Galaxy S6 Edge on Android 7.0
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompagny/com.mycompagny.ui.form.FormPreviewActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.mycompagny.ui.widget.IconView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.mycompagny.ui.widget.IconView
Have you got some explanations guys?
Thank you very much!
My application runs fine on API level 18+. But, when I run it on API 18, it crashes with following exception:
java.lang.RuntimeException: Unable to start activity ComponentInfo
{navdrawer.test.com.navigationdrawertest/navdrawer.test.com.navigationdrawertest.MainActivity}:
android.view.InflateException: Binary XML file line #111: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2362)
at android.app.ActivityThread.access$700(ActivityThread.java:168)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1329)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5493)
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:1225)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #111: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:804)
(many similar exception lines)
Caused by: java.lang.IllegalStateException: Cannot add header view to list -- setAdapter has already been called.
at android.widget.ListView.addHeaderView(ListView.java:265)
at android.widget.ListView.addHeaderView(ListView.java:294)
(many similar exception lines)
i'm try on this site
What am I doing wrong?
Check your relevant xml file where you might use wrong attribute which is not supported in Api 18