0

My project runs perfectly on android emulators (Pie 28 and Oreo 26) but when I tried to run it on my real phone which is Lollipop 5.1 ,My app is installed but it does not launch. Every time I open it says "Unfortunately your app has stopped".I have tried to clean ,build apk etc but problem does not changes.Here is my Manifest file , Gradle and stack trace.

Process: com.example.user.offlinemobilefinder, PID: 31218
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.user.offlinemobilefinder/com.example.user.offlinemobilefinder.WelcomeScreen}: android.view.InflateException: Binary XML file line #9: Error inflating class <unknown>
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2521)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595)
    at android.app.ActivityThread.access$800(ActivityThread.java:178)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
    at android.os.Handler.dispatchMessage(Handler.java:111)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5631)
    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:959)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
 Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class <unknown>
    at android.view.LayoutInflater.createView(LayoutInflater.java:633)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
    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.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
    at com.example.user.offlinemobilefinder.WelcomeScreen.onCreate(WelcomeScreen.java:19)
    at android.app.Activity.performCreate(Activity.java:6092)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2468)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595) 
    at android.app.ActivityThread.access$800(ActivityThread.java:178) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470) 
    at android.os.Handler.dispatchMessage(Handler.java:111) 
    at android.os.Looper.loop(Looper.java:194) 
    at android.app.ActivityThread.main(ActivityThread.java:5631) 
    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:959) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754) 
 Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:607)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) 
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) 
    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.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
    at com.example.user.offlinemobilefinder.WelcomeScreen.onCreate(WelcomeScreen.java:19) 
    at android.app.Activity.performCreate(Activity.java:6092) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2468) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595) 
    at android.app.ActivityThread.access$800(ActivityThread.java:178) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470) 
    at android.os.Handler.dispatchMessage(Handler.java:111) 
    at android.os.Looper.loop(Looper.java:194) 
    at android.app.ActivityThread.main(ActivityThread.java:5631) 
    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:959) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754) 
 Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.user.offlinemobilefinder:drawable/black" (7f060055)  is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060055 a=-1 r=0x7f060055}
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2690)
    at android.content.res.Resources.loadDrawable(Resources.java:2614)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.view.View.<init>(View.java:3791)
    at android.view.ViewGroup.<init>(ViewGroup.java:524)
    at android.widget.LinearLayout.<init>(LinearLayout.java:215)
    at android.widget.LinearLayout.<init>(LinearLayout.java:211)
    at android.widget.LinearLayout.<init>(LinearLayout.java:206)
    at java.lang.reflect.Constructor.newInstance(Native Method) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 
    at android.view.LayoutInflater.createView(LayoutInflater.java:607) 
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) 
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) 
    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.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
    at com.example.user.offlinemobilefinder.WelcomeScreen.onCreate(WelcomeScreen.java:19) 
    at android.app.Activity.performCreate(Activity.java:6092) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2468) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595) 
    at android.app.ActivityThread.access$800(ActivityThread.java:178) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470) 
    at android.os.Handler.dispatchMessage(Handler.java:111) 
    at android.os.Looper.loop(Looper.java:194) 
    at android.app.ActivityThread.main(ActivityThread.java:5631) 
    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:959) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754) 
    10-23 15:58:12.385 714-4209/? V/SettingsInterface:  from settings cache 
    , name = dropbox:data_app_crash , value = null
    10-23 15:58:12.386 714-4209/? V/SettingsInterface:  from settings cache 
    ,name = send_action_app_error , value = 1
    10-23 15:58:12.386 714-4209/? D/ActivityManager: SVC-mBroadcastQueues: 
    com.android.server.am.BroadcastQueue@1fbc8d07
    10-23 15:58:12.386 714-4209/? D/ActivityManager: SVC-mBroadcastQueues: 
    com.android.server.am.BroadcastQueue@10aa5e34
    10-23 15:58:12.386 714-4209/? W/ActivityManager:   Force finishing 
    activity 1 com.example.user.offlinemobilefinder/.WelcomeScreen

My Manifest file

<?xml version="1.0" encoding="utf-8"?>

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_SMS" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name=".WelcomeScreen"
        android:theme="@style/MainTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <receiver
        android:name=".BroadcastReciever"
        android:enabled="true"
        android:exported="true">
        <intent-filter>
            <action android:name="android.provider.Telephony.SMS_RECEIVED" />
        </intent-filter>
    </receiver>

    <activity android:name=".Login" />
    <activity android:name=".Register" />
    <activity android:name=".ForgotPassword" />
    <activity android:name=".WelcomePage" />
    <activity android:name=".SettingsPage" />
    <activity android:name=".AlarmActivity" />
    <activity android:name=".CreatePassword" />
    <activity
        android:name=".InputPassword"
        android:theme="@style/MainTheme" />
    <activity android:name=".ChangePattern"></activity>
</application>

And My Gradle

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.user.offlinemobilefinder"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
   }

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation('com.android.support:appcompat-v7:28.0.0') {
    force = true
}
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test:runner:1.0.2') {
    force = true
}
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.google.android.gms:play-services-location:16.0.0'

implementation 'com.andrognito.patternlockview:patternlockview:1.0.0'

 }

My Welcomescreen xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".WelcomeScreen">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/black"
    android:gravity="center"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/iv"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_gravity="center"
        android:src="@drawable/omf" />

    <TextView
        android:id="@+id/tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="15dp"
        android:text="Offline Mobile Finder"
        android:typeface="serif"
        android:textColor="@color/white"
        android:textSize="20sp"
        android:textStyle="bold" />

   </LinearLayout>
    </android.support.constraint.ConstraintLayout>

I am new in Android Studio that's why I don't understand problem.Thanks in advance for the help :).

  • 3
    show layout.xml which you inflate your `WelcomeScreen`, the problem is there with drawable/black on line 9 – RadekJ Oct 23 '19 at 11:49
  • error says there is a problem while inflating layout used in com.example.user.offlinemobilefinder.WelcomeScreen, ` Caused by`: android.content.res.Resources$NotFoundException: Resource "com.example.user.offlinemobilefinder:drawable/black" (7f060055) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060055 a=-1 r=0x7f060055} – Rishabh Dhawan Oct 23 '19 at 11:51
  • Looks like a duplicate of [Resources$NotFoundException: Resource is not a Drawable (color or path)?](https://stackoverflow.com/questions/29095063/resourcesnotfoundexception-resource-is-not-a-drawable-color-or-path) – SqueezyMo Oct 23 '19 at 11:51
  • Updated with Welcomescreen xml. – Azmat Inayat Oct 23 '19 at 14:51
  • Seems something wrong with your colour as @RishabhDhawan suggested – Ruthwik Warrier Oct 23 '19 at 18:18

2 Answers2

0
 Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.user.offlinemobilefinder:drawable/black" (7f060055)  is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060055 a=-1 r=0x7f060055}

Something wrong with your color drawable/black

Maybe duplicate of : Resources$NotFoundException: Resource is not a Drawable (color or path)?

Benjamin
  • 401
  • 1
  • 3
  • 16
  • Yes Thank you.......I put the image in Drawable folder which was causing the error So I put the image in drawable-hdpi folders and problem solved....Thank you once again for all who helped :) – Azmat Inayat Oct 24 '19 at 08:24
0

find out layout which is supported API, if your lower API would be 23 and you are using some function which is required API 25, so the problem occur, Find out.. like Select project file -> see in Layout and drawable, any file which is in diff api like -> drawable -> drawable-25 or ->Layout ->Layout-25 if found the move drawable-25 item into main drawable like wise for Layout also, it will solve proble