I have put the admob .jar file in my project via project structure:
And I added code in for the admob banner into my layout files:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e5e5e5"
android:orientation="vertical" >
<com.google.ads.AdView android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="taken out for stack"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
ads:loadAdOnCreate="true"/>
<ListView
android:id="#+id/yourTasteStatistics"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:dividerHeight="0px"
android:divider="#null"
>
</ListView>
</LinearLayout>
But when I open a fragment with an ad on it, my app automatically crashes...Any ideas what step I must be missing here?
Here is the output:
05-13 17:56:44.053 12606-12606/com.beerportfolio.freeBP E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.beerportfolio.freeBP, PID: 12606
android.view.InflateException: Binary XML file line #14: Error inflating class com.google.ads.AdView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at com.beerportfolio.freeBP.BeerPage.onCreateView(BeerPage.java:30)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1097)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1895)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1514)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:958)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:446)
at android.os.Handler.handleCallback(Handler.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.ads.AdView" on path: DexPathList[[zip file "/data/app/com.beerportfolio.freeBP-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.beerportfolio.freeBP-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java)
at java.lang.ClassLoader.loadClass(ClassLoader.java)
at java.lang.ClassLoader.loadClass(ClassLoader.java)
at android.view.LayoutInflater.createView(LayoutInflater.java)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at com.beerportfolio.freeBP.BeerPage.onCreateView(BeerPage.java:30)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1097)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1895)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1514)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:958)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:446)
at android.os.Handler.handleCallback(Handler.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(Native Method)
Line 30 is just where the fragments view is inflated. Make sense its crashing there if it does not like my admob ads.
Update:
As noted in the comments I was using out of date libs. I then followed this link for instructions on how to update to use google play services instead.
https://developer.android.com/google/play-services/setup.html?hl=pt-br
My problem is here on this step:
apply plugin: 'android'
...
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:4.3.23'
}
When I add that to my grade the gradle fails to sync. My grade looks like this now:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
compile 'com.google.android.gms:play-services:4.3.23'
}
}
allprojects {
repositories {
mavenCentral()
}
}
And give me this error:
Error:(9, 0) Build script error, unsupported Gradle DSL method found: 'compile()'!
Possible causes could be:
- you are using Gradle version where the method is absent (Fix Gradle settings)
- you didn't apply Gradle plugin which provides the method (Apply Gradle plugin)
- or there is a mistake in a build script (Goto source)
Your dependencies block is in the wrong place. It looks like you edited build.gradle in your top level directory.
Open the one in your application module instead. There should be an android block there etc. Or just use the project structure dialog in android studio to edit it.
Related
I created a project in android studio and I did not put a code on it. But when I try to install it on my cellphone jelly bean(4.2.2) version. It returns "Exception while inflating ".
I got this error
08-04 15:18:38.377 15045-15045/? E/VdcInflateDelegate﹕ Exception while inflating <vector>
org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0
at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:535)
at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:472)
at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:436)
at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:708)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:348)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:181)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:689)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:83)
at android.support.v7.app.AppCompatDelegateImplV7.<init>(AppCompatDelegateImplV7.java:146)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:28)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:41)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:193)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:173)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:511)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
at dunhill.diary_sarah.MainActivity.onCreate(MainActivity.java:12)
at android.app.Activity.performCreate(Activity.java:5326)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2218)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309)
at android.app.ActivityThread.access$700(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
I'm tried to add "vectorDrawables.useSupportLibrary = true" on android default config but still not working. also put this code on build.gradle. "generatedDensities = []" and "aaptOptions { additionalParameters "--no-version-vectors" }". I got this error "Error:(13, 0) No such property: generatedDensities for class: com.android.build.gradle.internal.dsl.ProductFlavor_Decorated"
I'm tried to add "vectorDrawables.useSupportLibrary = true"
In order to use it, you need at lease version 2 of the android gradle plugin. At the moment you are using 1.3. You should also avoid mixing versions when it comes to compileSdkVersion, buildToolsVersions and support library.
I changed compile 'com.android.support:appcompat-v7:24.1.1' to compile 'com.android.support:appcompat-v7:23.2.1' and it's working now.
I have never met so strange issue so far.
The app compiles fine. But at first run it crashes on the test device, but if the project is cleaned and re-run the app works fine.
If I try to install the apk the result is the same: installing the app crashes but after reinstalling it runs fine.
The issue is happening on all of my test devices and under Eclipss and Android Studio. I spent many hours to find a similar case but no avail.
The previous version of the app worked fine, but if I revert the files to an earlier version the issue remains.
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.plexnor.android.good.ViewfinderView" on path: DexPathList[[zip file "/data/app/com.plexnor.android.good-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.plexnor.android.good-1, /vendor/lib, /system/lib]]
My guess something went wrong with project set up but could not find the culprit. Deleting the bin folder, making countless project cleaning and restarts did not lead anywhere ...
The full stack trace:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.plexnor.android.good/com.plexnor.android.good.CaptureActivity}: android.view.InflateException: Binary XML file line #17: Error inflating class com.plexnor.android.good.ViewfinderView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2425)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
at android.app.ActivityThread.access$900(ActivityThread.java:171)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5506)
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:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class com.plexnor.android.good.ViewfinderView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
at android.view.LayoutInflater.inflate(LayoutInflater.java:463)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:359)
at android.app.Activity.setContentView(Activity.java:2010)
at com.plexnor.android.good.CaptureActivity.onCreate(SourceFile:317)
at android.app.Activity.performCreate(Activity.java:5426)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2389)
... 11 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.plexnor.android.good.ViewfinderView" on path: DexPathList[[zip file "/data/app/com.plexnor.android.good-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.plexnor.android.good-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.view.LayoutInflater.createView(LayoutInflater.java:565)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
... 22 more
android.view.InflateException: Binary XML file line #17: Error inflating class com.plexnor.android.good.ViewfinderView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
at android.view.LayoutInflater.inflate(LayoutInflater.java:463)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:359)
at android.app.Activity.setContentView(Activity.java:2010)
at com.plexnor.android.good.CaptureActivity.onCreate(SourceFile:317)
at android.app.Activity.performCreate(Activity.java:5426)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2389)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
at android.app.ActivityThread.access$900(ActivityThread.java:171)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5506)
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:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.plexnor.android.good.ViewfinderView" on path: DexPathList[[zip file "/data/app/com.plexnor.android.good-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.plexnor.android.good-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.view.LayoutInflater.createView(LayoutInflater.java:565)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
... 22 more
java.lang.ClassNotFoundException: Didn't find class "com.plexnor.android.good.ViewfinderView" on path: DexPathList[[zip file "/data/app/com.plexnor.android.good-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.plexnor.android.good-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.view.LayoutInflater.createView(LayoutInflater.java:565)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
at android.view.LayoutInflater.inflate(LayoutInflater.java:463)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:359)
at android.app.Activity.setContentView(Activity.java:2010)
at com.plexnor.android.good.CaptureActivity.onCreate(SourceFile:317)
at android.app.Activity.performCreate(Activity.java:5426)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2389)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
at android.app.ActivityThread.access$900(ActivityThread.java:171)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5506)
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:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
EDIT 1:
The app crashes earlier even entering the main activity when processing the layout.
The beginning of the layout:
<?xml version="1.0" encoding="UTF-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
<SurfaceView
android:id="#+id/preview_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<RelativeLayout
android:id="#+id/relative_layout_main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="0dp"
android:layout_marginTop="0dp" >
<RelativeLayout
android:id="#+id/learning_swipe_relative_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:background="#android:color/transparent" >
<ImageView
android:id="#+id/learningSwipe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:padding="30dp"
android:src="#drawable/swipe" />
</RelativeLayout>
<com.plexnor.android.good.ViewfinderView
android:id="#+id/viewfinder_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RelativeLayout
android:id="#+id/learning_relative_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#android:color/transparent" >
Whats your logcat throws
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.plexnor.android.good.ViewfinderView"
ClassNotFoundException in Java is a subclass of java.lang.Exception and Comes when Java Virtual Machine tries to load a particular class and doesn't found the requested class in classpath.
Another important point about this Exception is that, It is a checked Exception and you need to provide explicitly Exception handling while using methods which can possibly throw classnotfoundexception in java either by using try-catch block or by using throws clause.
Solution
Check whether your classpath contains that jar, if your classpath
doesn't contain the jar then just add that class in your classpath.
Because I could not solve the issue I suspended that project for some months. Using Eclipse in my another project the same issue emerged after including a third party SDK to the project.
Cleaning project, changing things in build path did not help. So, I cloned the project to a new workspace and added the SDK ... and it worked that way. After trying out the old abandoned project it worked out of the box. Thus I think the issue caused by a bug in the development environment.
I had an app working alright until today. To do some integration with a wearable module (I use Android Studio), I had to update Google Play Services from 6.1.0 to 7.3.0 (the latest). I also use an external library, which I know it works fine and there is no problem with it.
The thing is when I update my gradle file with the new Google Play Services version, I get the NoClassDefFoundError at runtime (complaining on my external library). I've tried everything, but nothing works (made sure the .jar is ok, that is actually exported, cleaned 1000 times, rebuild, delete build folder, etc). If I set the Google Play Services to 6.1.11 back, the app run as it used to be.
This is driving me crazy...
My build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:7.3.0'
compile files('libs/mylibrary.jar')
}
The error log:
05-06 15:23:56.544 31574-31574/com.rippll.okchat E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.rippll.okchat, PID: 31574
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/rippll/geowave/Geowave;
at com.rippll.okchat.MainActivity.onCreate(MainActivity.java:92)
at android.app.Activity.performCreate(Activity.java:5953)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1128)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
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:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.rippll.geowave.Geowave" on path: DexPathList[[zip file "/data/app/com.rippll.okchat-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
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 com.rippll.okchat.MainActivity.onCreate(MainActivity.java:92)
at android.app.Activity.performCreate(Activity.java:5953)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1128)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2388)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
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:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
Suppressed: java.lang.NoClassDefFoundError: com.rippll.geowave.Geowave
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 16 more
Suppressed: java.lang.ClassNotFoundException: com.rippll.geowave.Geowave
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 15 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Google Wear doesn't support Google Play Services v7.x yet.
So, you need to use Google Play Services v6.x in your Wearable project, for example in your build.gradle file of wear project:
dependencies {
compile 'com.google.android.gms:play-services:6.5.87'
}
But in your mobile (handheld) project you can use latest v7.x library version, if you're really need it, like:
dependencies {
wearApp project(':yourWearProjectName')
compile 'com.android.support:appcompat-v7:22.0.0+'
}
There is a limit of ~65000 methods for your .apk. Google Play services grow in size with each release and when you include them in your project you may very well jump over that method count limit. The solution is to use only the modules you need.
Please read carefully https://developer.android.com/google/play-services/setup.html
I'm having a serious problem with a runtime exception when inflating an XML layout that includes the XWalkView...
Stack trace :
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Use SharedXWalkView if you want to support shared mode
at org.xwalk.core.ReflectionHelper.handleException(ReflectionHelper.java:233)
at org.xwalk.core.ReflectionHelper.handleException(ReflectionHelper.java:237)
at org.xwalk.core.ReflectionHelper.init(ReflectionHelper.java:132)
at org.xwalk.core.ReflectionHelper.loadClass(ReflectionHelper.java:199)
at org.xwalk.core.ReflectionHelper$ConstructorHelper.loadConstructor(ReflectionHelper.java:37)
at org.xwalk.core.ReflectionHelper.createInstance(ReflectionHelper.java:246)
at org.xwalk.core.XWalkView.<init>(XWalkView.java:169)
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 android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
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 com.bean.project.XWalkUIActivity.onCreate(XWalkUIActivity.java:51)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.RuntimeException: Use SharedXWalkView if you want to support shared mode
at org.xwalk.core.ReflectionHelper.handleException(ReflectionHelper.java:237)
at org.xwalk.core.ReflectionHelper.init(ReflectionHelper.java:132)
XML :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/com_bean_project_content"
android:theme="#style/com_bean_project_black" >
<!-- bottom controls -->
<RelativeLayout
android:id="#+id/com_bean_project_bottom_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<!-- some buttons, nothing to worry about -->
</RelativeLayout>
<!-- fills most of the parent view -->
<org.xwalk.core.XWalkView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/com_bean_project_webview"
android:layout_alignParentTop="true"
android:layout_above="#id/com_bean_project_bottom_layout"/>
</RelativeLayout>
Things I have done :
1) in Android Studio, I am using the armeabi-v7a folder from the library and xwalk_core_library_java_app_part.jar and xwalk_core_library_java_library_part.jar both of these are included in the dependencies. I don't know whether I should only use one of those jar's? I couldn't find anything about it in any documents.
2) the activity with XWalkView has android:hardwareAccelerated="true"
3) on the crosswalk downloads page (https://crosswalk-project.org/documentation/downloads.html) I have downloaded version 11.40.277.7 of Android webview (ARM)
4) I also merged the "res" folder from crosswalk into my project, but this makes no difference.
5) I've also tried programmatic inflation, however, it also excepts just with a new XWalkView(mParentActivity, mParentActivity); (I know, silly constructor):
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Use SharedXWalkView if you want to support shared mode
at org.xwalk.core.ReflectionHelper.handleException(ReflectionHelper.java:233)
at org.xwalk.core.ReflectionHelper.handleException(ReflectionHelper.java:237)
at org.xwalk.core.ReflectionHelper.init(ReflectionHelper.java:132)
at org.xwalk.core.ReflectionHelper.loadClass(ReflectionHelper.java:199)
at org.xwalk.core.ReflectionHelper$ConstructorHelper.loadConstructor(ReflectionHelper.java:37)
at org.xwalk.core.ReflectionHelper.createInstance(ReflectionHelper.java:246)
at org.xwalk.core.XWalkView.<init>(XWalkView.java:192)
For inspiration, I've looked at https://crosswalk-project.org/apis/embeddingapidocs/reference/org/xwalk/core/XWalkView.html however, it's no help on this issue.
Maybe this will help you:
At first i also tried to use jars in my app. That didn't work and i got the same exceptions as you.
Then i stumbled upon this sample app that shows how to use Crosswalk.
I then copied the build into my app and everything worked ok.
Here is what i added in my gradle file:
in the repositories section i added one line (below the crashlytics..)
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven'}
maven { url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'}
}
In the dependencies section i also added one line - the last one:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'org.xwalk:xwalk_core_library:10.39.235.15'
}
This is the xml for the activity:
<org.xwalk.core.XWalkView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/walk_view"
android:layout_width="fill_parent"
android:background="#000000"
android:layout_height="fill_parent"
/>
And this is how i use it in the java code:
private void setXView(){
mXview = (XWalkView)findViewById(R.id.walk_view);
mXview.load("http://www.cnn.com",null);
}
Don't forget to delete the jars in your app or you might get a compilation error if you have fileTree(dir: 'libs', include: ['*.jar']) in your dependencies.
After a day of insane experimentation, I finally gave up on trying to store a local copy of the library.
Instead, I went with Maven using these instructions: https://crosswalk-project.org/documentation/embedding_crosswalk/crosswalk_aar.html
At the bottom of that page is a link to a sample app that's set up with Maven - which is useful.
Note: to find out what versions of the library are available, go here: https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/
for example, instead of the "beta" dependency, you would have compile 'org.xwalk:xwalk_core_library:12.41.296.5'
After having it set up with maven, I then reverted to the XML inflation.
However, I was then faced with
04-02 16:38:31.036 14165-14165/com.bean.project W/System.err﹕ Caused by: java.lang.ClassCastException: android.view.ContextThemeWrapper cannot be cast to android.app.Activity
04-02 16:38:31.037 14165-14165/com.bean.project W/System.err﹕ at org.xwalk.core.internal.XWalkViewInternal.<init>(XWalkViewInternal.java:197)
04-02 16:38:31.037 14165-14165/com.bean.project W/System.err﹕ at org.xwalk.core.internal.XWalkViewBridge.<init>(XWalkViewBridge.java:46)
the insanity continues...
public XWalkViewInternal(Context context, AttributeSet attrs) {
super(convertContext(context), attrs);
checkThreadSafety();
mActivity = (Activity) context;
mContext = getContext();
init(mContext, attrs);
}
how can they possibly think that's a good idea ??!! /facepalm
EDIT: to get the XWalkView added to a layout programmatically I put a placeholder (empty) RelativeLayout in the XML with ID FULLSCREEN_YOUTUBE_CONTAINER_ID and then in onCreate() of the activity I did:
mYoutubeVideoViewContainer = (RelativeLayout) mLayoutView.findViewById(FULLSCREEN_YOUTUBE_CONTAINER_ID);
mYoutubeWebView = new XWalkView(mParentActivity, mParentActivity);
RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
mYoutubeVideoViewContainer.addView(mYoutubeWebView, relativeParams);
I'm trying to use RecyclerView in my existing project, builds without errors but getting no class found error for the RecyclerView while inflating. Cannot see what I'm doing wrong. Thanks for helping!
//activity_main.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
//MainActivity.onCreate
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
ItemData itemsData[] = { new ItemData("Help",R.drawable.visa),
new ItemData("Delete",R.drawable.sample),
new ItemData("Cloud",R.drawable.sample),
new ItemData("Favorite",R.drawable.sample),
new ItemData("Like",R.drawable.sample),
new ItemData("Rating",R.drawable.sample)};
// 2. set layoutManger
recyclerView.setLayoutManager(new LinearLayoutManager(this));
// 3. create an adapter
MyAdapter mAdapter = new MyAdapter(itemsData);
// 4. set adapter
recyclerView.setAdapter(mAdapter);
// 5. set item animator to DefaultAnimator
//recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setHasFixedSize(true);
}
//build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.domain.project"
minSdkVersion 19
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:+'
compile 'com.android.support:support-v13:+'
compile project(':facebook-3.15')
compile project(':parse-1.5.1')
compile project(':viewpagerindicator-2.4.1')
compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.1.2'
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:+'
}
configurations {
// to avoid double inclusion of support libraries
all*.exclude group: 'com.android.support', module: 'support-v4'
}
//LOGCAT
08-24 17:49:27.626 27544-27544/com.domain.project E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.domain.project, PID: 27544
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.domain.project/com.domain.project.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class android.support.v7.widget.RecyclerView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2215)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2264)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5139)
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:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class android.support.v7.widget.RecyclerView
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:343)
at android.app.Activity.setContentView(Activity.java:1929)
at com.domain.project.MainActivity.onCreate(MainActivity.java:35)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2264)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5139)
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:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:343)
at android.app.Activity.setContentView(Activity.java:1929)
at com.domain.project.MainActivity.onCreate(MainActivity.java:35)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2264)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5139)
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:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: android.support.v4.util.Pools$SimplePool
at android.support.v7.widget.RecyclerView.<init>(RecyclerView.java:121)
at android.support.v7.widget.RecyclerView.<init>(RecyclerView.java:213)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:343)
at android.app.Activity.setContentView(Activity.java:1929)
at com.domain.project.MainActivity.onCreate(MainActivity.java:35)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2264)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5139)
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:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
Or... in my case, I was including the androidx version of RecyclerView in my dependencies (build.gradle) but using the other in my XML... Doh.
Replaced
android.support.v7.widget.RecyclerView
with
androidx.recyclerview.widget.RecyclerView
and it worked! :)
In the xml declaration of the RecyclerView:
Replace
<android.support.v7.widget.RecyclerView
with
<androidx.recyclerview.widget.RecyclerView
Hope this works ^_^
Please check your support libs are updated to latest..
com.android.support:support-v4: and com.android.support:recyclerview-v7
for the new API Version, on the build.gradle - project dependencies add :
implementation 'androidx.recyclerview:recyclerview:1.0.0'
and in the layout, you should replace :
android.support.v7.widget.RecyclerView
with
androidx.recyclerview.widget.RecyclerView
In your layout file:
Use:
androidx.recyclerview.widget.RecyclerView
Instead:
android.support.v7.widget.RecyclerView
It will work for you.
If you do not want to use Androidx then in your gradle.properties file and do this:
android.useAndroidX=false
android.enableJetifier=false
My problem was that the library was compiled using JDK1.6 instead of 1.7.
Found the solution here link
Add Dependencies in gradle file.
dependencies{
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
}
Just add following into your proguard-rules.pro,
-keep public class android.support.v7.widget.** { *; }
Make sure you have added proper dependencies for recyclerView.
Then check whether you have dependecy for cardView.
If yes, then
remove card view dependency
sync project
then again add card view dependency
clean project
rebuild project
It worked for me
I figured it out. Removing the following configuration in build.gradle makes the recyclerview work. This leads me to another question: android studio: gradle dependency error
--
configurations {
// to avoid double inclusion of support libraries
all*.exclude group: 'com.android.support', module: 'support-v4'
}
After trying everything on internet i solved recyclerview inflating error by observing small mistake.
First,
Did you check your android-support-v7-recyclerview.jar library present in libs folder? if it is then check if your manifest file that has target sdk version to 21
<uses-sdk
android:minSdkVersion="11" //or whatever you need
android:targetSdkVersion="21" />
may be this can help for someone in future and not wasting days behind it as i did.
Check out my answer here Error inflating class RecyclerView.
In short, you need to import recyclerview and appcompat dependencies and sync before you are trying to add RecyclerView to your XML.
--- Quoted from Android website.
Dependencies
To use these features in versions of Android earlier than 5.0 (API level 21), include the Android v7 Support Library in your project as a Gradle dependency:
dependencies {
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
}
For make it work under Eclipse in my case I added RecyclerView as Library in the workspace. And then added to my project under ANDROID LIBRARY. Finally. Three hours lost.
I had a similar same error message, and tried many of the suggested steps from the answers on this site.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abc.def/com.abc.def.MainActivity}: android.view.InflateException: Binary XML file line #8:
Finally realized that for some reasons the tag in my layout was:
android.support.v7.internal.widget.RecyclerView
instead of
android.support.v7.widget.RecyclerView.
I am not sure how 'internal' crept in between v7 and widget, but once I removed that, the error went away. Not saying other people will make the same mistake, but just to let people know that a typo somewhere in your layout xml could be the cause of this error message.
Check your layout.xml file...Cant stop my laughing...
I made a stupid mistake...
I put
<android.support.v7.wodget.RecyclerView
instead of
<android.support.v7.widget.RecyclerView
look at the small 'o', it wasted me 30 mins or more to check other files...
[looking forward my answer can save your time]
Add below line in Gradle file:
dependencies {
//recyclerview
implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
Add below code in your activity layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerview"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Your Android studio auto imports the androidx recyclerview.
AndroidX is a major improvement to the original Android Support Library. Like the Support Library, AndroidX ships separately from the Android OS and provides backwards-compatibility across Android releases.
Here is the reference AndroidX:
https://developer.android.com/jetpack/androidx
I too got same exception.
simple solution is add layout_behaviour to recycler view:
app:layout_behavior="#string/appbar_scrolling_view_behavior"