I am trying to make an app for my WordPress website using json... the app debug successfully but not started it stopped working when i try to open app.. Please Help
Here is activity_main.xml File Please Check this out
activity_main.xml
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/recycler_view">
</android.support.v7.widget.RecyclerView>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressbar"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
Logcat File
2019-11-22 08:33:19.368 2734-2734/? D/AndroidRuntime: Shutting down VM
2019-11-22 08:33:19.369 2734-2734/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ats.sarkarijobs, PID: 2734
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ats.sarkarijobs/com.ats.sarkarijobs.MainActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class android.support.design.widget.CoordinatorLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class android.support.design.widget.CoordinatorLayout
Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.support.design.widget.CoordinatorLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.CoordinatorLayout" on path: DexPathList[[zip file "/data/app/com.ats.sarkarijobs-3/base.apk"],nativeLibraryDirectories=[/data/app/com.ats.sarkarijobs-3/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.view.LayoutInflater.createView(LayoutInflater.java:609)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.ats.sarkarijobs.MainActivity.onCreate(MainActivity.java:35)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
I have added activity_main.xml and logcat file please check this out.
Your project is AndroidX enabled, but you are not using AndroidX dependencies in your app level build.gradle.
So, inside your project
Navigate to the Refactor menu
Click on Migrate to AndroidX
You might have to also make changes to your XML layouts-
Change android.support.design.widget.CoordinatorLayout to androidx.coordinatorlayout.widget.CoordinatorLayout and android.support.v7.widget.RecyclerView to androidx.recyclerview.widget.RecyclerView
and likewise CardView to androidx.cardview.widget.CardView
Related
I am totally new to android development and trying to learn it by my own, I have done some coding in xml file but when I run the application, app has install in my phone but not opening.
Here is the error log:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sumita.yourhelp, PID: 6407
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sumita.yourhelp/com.sumita.yourhelp.MainActivity}: android.view.InflateException: Binary XML file line #39: Binary XML file line #39: Error inflating class androidx.appcompat.widget.AppCompatButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2994)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1766)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6977)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:528)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:910)
Caused by: android.view.InflateException: Binary XML file line #39: Binary XML file line #39: Error inflating class androidx.appcompat.widget.AppCompatButton
Caused by: android.view.InflateException: Binary XML file line #39: Error inflating class androidx.appcompat.widget.AppCompatButton
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:650)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:797)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:737)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:870)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:831)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:710)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at com.sumita.yourhelp.MainActivity.onCreate(MainActivity.java:12)
at android.app.Activity.performCreate(Activity.java:7227)
at android.app.Activity.performCreate(Activity.java:7218)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2947)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1766)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6977)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:528)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:910)
Caused by: java.lang.UnsupportedOperationException: Can't convert to ComplexColor: type=0x1
at android.content.res.ResourcesImpl.loadComplexColorForCookie(ResourcesImpl.java:1217)
at android.content.res.ResourcesImpl.loadComplexColorFromName(ResourcesImpl.java:1094)
at android.content.res.ResourcesImpl.loadColorStateList(ResourcesImpl.java:1173)
at android.content.res.Resources.loadColorStateList(Resources.java:1076)
at android.content.res.TypedArray.getColorStateList(TypedArray.java:541)
at android.view.View.<init>(View.java:5180)
at android.widget.TextView.<init>(TextView.java:867)
at android.widget.Button.<init>(Button.java:166)
at android.widget.Button.<init>(Button.java:141)
at androidx.appcompat.widget.AppCompatButton.<init>(AppCompatButton.java:80)
at androidx.appcompat.widget.AppCompatButton.<init>(AppCompatButton.java:75)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:650)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:797)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:737)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:870)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:831)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:710)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at com.sumita.yourhelp.MainActivity.onCreate(MainActivity.java:12)
at android.app.Activity.performCreate(Activity.java:7227)
at android.app.Activity.performCreate(Activity.java:7218)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2947)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1766)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6977)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:528)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:910)
And here is the xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical"
android:padding="11dp"
android:gravity="center_horizontal">
<ImageView
android:layout_width="match_parent"
android:layout_height="258dp"
android:contentDescription="#string/About"
android:scaleType="fitXY"
android:src="#drawable/ic_contact_us" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Aboutus"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="?android:attr/colorFocusedHighlight"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="12"
android:hint="enter number"
android:inputType="number" />
<androidx.appcompat.widget.AppCompatButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="#color/material_dynamic_neutral40"
android:text="contact us"
android:textColor="#color/black"/>
</LinearLayout>
Two relevant parts of your error log.
This section points to a problem in line 39 of your layout file, inflating an AppCompatButton.
Caused by: android.view.InflateException: Binary XML file line #39: Binary XML file line #39: Error inflating class androidx.appcompat.widget.AppCompatButton
There's also this in your error log:
Caused by: java.lang.UnsupportedOperationException: Can't convert to ComplexColor: type=0x1
So, taken together, your error log suggests that there's a problem with a color that's being used in an AppCompatButton on line 39 of your layout XML.
If you look at that line in your layout file, you'll see this:
android:textColor="#color/black"/>
Taken together, I would guess that you haven't defined the color you've called black correctly. Try and replace it with #android:color/black and see if that works. If it does, then you need to fix whatever color you've defined for black in your resources files.
I know that this question is have asked many times and respective solution is on that portal, but none of them solve my problem.
I created an android project on android studio 3.0.1 and when I click on green symbol to run emulator, on AVD it shows me project has stopped--Open app again.
I saw the suggestion for this problem as Logcat and breakpoint and so on. But I don't know how actually use it.
I am new on android development so please help me how to use logcat or suggest me any other way to fix this problem my logcat is as follow:-
06-03 13:18:39.644 6812-6812/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.ram.projects6b, PID: 6812
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ram.projects6b/com.example.ram.projects6b.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.v7.widget.Fab
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.v7.widget.Fab
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.v7.widget.Fab
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.Fab" on path: DexPathList[[zip file "/data/app/com.example.ram.projects6b-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.ram.projects6b-2/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.view.LayoutInflater.createView(LayoutInflater.java:609)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:286)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.ram.projects6b.MainActivity.onCreate(MainActivity.java:17)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
The problem describe with this error log:
android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.v7.widget.Fab
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.v7.widget.Fab
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.Fab" on path: DexPathList[[zip file
You're using incorrect View tag in your layout. You're using:
android.support.v7.widget.Fab
where there is no Fab View in Support library.
Probably what you wanted is FloatingActionButton:
android.support.design.widget.FloatingActionButton
I downloaded the tableview jar file library and copy to libs folder in my project and add it to gradle from File->Project Structure but there is problem when i add com.evrencoskun.tableview.TableView to xml and error :
Binary XML file line #11: Binary XML file line #11: Error inflating class com.evrencoskun.tableview.TableView
Caused by: android.view.InflateException: Binary XML file line #11: Binary XML file line #11: Error inflating class com.evrencoskun.tableview.TableView
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.evrencoskun.tableview.TableView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.farzad.table.MainActivity.onCreate(MainActivity.java:13)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/evrencoskun/tableview/R$dimen;
at com.evrencoskun.tableview.TableView.initialDefaultValues(TableView.java:129)
at com.evrencoskun.tableview.TableView.<init>(TableView.java:116)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.farzad.table.MainActivity.onCreate(MainActivity.java:13)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.evrencoskun.tableview.R$dimen" on path: DexPathList[[zip file "/data/app/com.example.farzad.table-2/base.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.farzad.table-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.farzad.table-2/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.evrencoskun.tableview.TableView
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.evrencoskun.tableview.TableView>
</LinearLayout
package com.example.farzad.table;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
I don't want add this library by :
compile 'com.evrencoskun.library:tableview:0.8.8'
because i want to change it and add offline to my projects.
You got this issue, because your added jar did not compile. perhaps you are doing in wrong way.
Instead of telling way to add jar in android studio, i want tell you that if you want edit that library. You can clone it from library github page, and add that downloaded module to your app in Android Studio.
I'm trying to show a MapView inside a Fragment and I get an error when I inflate it:
03-21 14:34:44.234 32691-32691/com.example.javiersanzrozalen.fatrunners E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.javiersanzrozalen.fatrunners, PID: 32691
android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class com.google.android.gms.maps.MapView
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.android.gms.maps.MapView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430) at android.view.LayoutInflater.createView(LayoutInflater.java:645) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.inflate(LayoutInflater.java:495) at android.view.LayoutInflater.inflate(LayoutInflater.java:426) at com.example.javiersanzrozalen.fatrunners.Fragments.NuevaCarreraFragment.onCreateView(NuevaCarreraFragment.java:53) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595) at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758) at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363 at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149) at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/safeparcel/AbstractSafeParcelable; at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source) at com.google.android.gms.maps.MapView.<init>(Unknown Source) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:430) at android.view.LayoutInflater.createView(LayoutInflater.java:645) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.inflate(LayoutInflater.java:495) at android.view.LayoutInflater.inflate(LayoutInflater.java:426) at com.example.javiersanzrozalen.fatrunners.Fragments.NuevaCarreraFragment.onCreateView(NuevaCarreraFragment.java:53) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595) at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758) at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363 at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149) at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable" on path: DexPathList[[zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/base.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.javiersanzrozalen.fatrunners-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.javiersanzrozalen.fatrunners-2/lib/x86, /system/lib, /vendor/lib]]
03-21 14:34:44.234 32691-32691/com.example.javiersanzrozalen.fatrunners E/AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 27 more
Any idea ? This is the XML where I place my MapView:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Fragments.NuevaCarreraFragment">
<com.google.android.gms.maps.MapView
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
UPDATE
Finally solved it compiling the last version of Google Maps library recommended.
You are attempting to use the original version of Google Maps support for Android (com.google.android.maps). We refer to that now as Maps V1.
This will not work, as Maps V1 has been deprecated for over two years. You can no longer get API keys for it, so even if your code would be correct, it would not work. The crash is because the old MapView had to be used inside of a MapActivity, as the error indicates.
The current version of Google Maps support for Android — Maps V2 — has a very different API and does not involve classes in the com.google.android.maps package.
I really don't know what's happening. On Android Studio every thing is working fine, but when I try to run the app on my phone it gives this error.
AndroidRuntime: FatalException:
Process: com.example.vb.textreader, PID: 29524
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.vb.textreader/com.example.vb.textreader.ocrcapture}: android.view.InflateException: Binary XML file line #10: Error inflating class com.example.vb.textreader.CameraSourcePreview
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2332)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2394)
at android.app.ActivityThread.access$800(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5276)
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:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.example.vb.textreader.CameraSourcePreview
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:761)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:810)
at android.view.LayoutInflater.inflate(LayoutInflater.java:508)
at android.view.LayoutInflater.inflate(LayoutInflater.java:418)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.vb.textreader.ocrcapture.onCreate(ocrcapture.java:67)
at android.app.Activity.performCreate(Activity.java:6041)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1109)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2285)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2394)
at android.app.ActivityThread.access$800(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5276)
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:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.vb.textreader.CameraSourcePreview" on path: DexPathList[[zip file "/data/app/com.example.vb.textreader-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.view.LayoutInflater.createView(LayoutInflater.java:575)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:747)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:810)
at android.view.LayoutInflater.inflate(LayoutInflater.java:508)
at android.view.LayoutInflater.inflate(LayoutInflater.java:418)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.vb.textreader.ocrcapture.onCreate(ocrcapture.java:67)
at android.app.Activity.performCreate(Activity.java:6041)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1109)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2285)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2394)
at android.app.ActivityThread.access$800(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5276)
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:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.example.vb.textreader.CameraSourcePreview" on path: DexPathList[[dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-support-annotations-23.4.0_932ddf769cdf6f7ff910db3bda1b13074bfa8aca-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.example.vb.textreader/files/instant-run/dex/slice-internal_impl-23.4.0_ed28e3a48cbb17d2b91d4065fb1975ae0dafdc68-classes.dex", dex file "/data/data/com.example.vb.textreader/fil
I am trying to create an OCR app on android. There is no error in the code as viewed in Android Studio. Any help is greatly appreciated.
XML Code
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/topLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
<com.example.vb.textreader.proprietary.CameraSourcePreview
android:id="#+id/preview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.example.vb.textreader.GraphicOverlay
android:id="#+id/graphicOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.example.vb.textreader.proprietary.CameraSourcePreview>
It seems that there is a custom view com.example.vb.textreader.CameraSourcePreview that's used in a XML layout file that's causing the problem.
Check it's attributes and implementation. if it depends on a library, check the dependencies in build.gradle.
It seems you are trying to use com.example.vb.textreader.CameraSourcePreview which must be a custom view you implemented. One thing that comes to my mind is to check to see if the custom view resides exactly at that location.
I'm not sure whether the provided solution is related to your issue but
try tocompile 'com.android.support:design:*****' instead of com.android.support:appcompat-v7:*****