The application currently has a Cardview, recyclerview, and its adapter. The cardView has and three images(one is a URL image and two are vector drawables) and two texts. I happen to face a crash everytime I launch the application. As it is my first time making an android app that requires Internet connection I suspect the problem to be around the dependencies/gradle/manifest.xml etc. The output is as so:
2021-06-17 03:09:45.376 8822-8822/? I/udio_downloade: Not late-enabling -Xcheck:jni (already on)
2021-06-17 03:09:45.415 8822-8822/? E/udio_downloade: Unknown bits set in runtime_flags: 0x8000
2021-06-17 03:09:45.416 8822-8822/? W/udio_downloade: Unexpected CPU variant for X86 using defaults: x86
2021-06-17 03:09:45.621 8822-8822/com.example.audio_downloader W/RenderThread: type=1400 audit(0.0:564): avc: denied { write } for name="property_service" dev="tmpfs" ino=8412 scontext=u:r:untrusted_app:s0:c146,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.example.audio_downloader
2021-06-17 03:09:45.635 8822-8855/com.example.audio_downloader D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
2021-06-17 03:09:45.636 8822-8855/com.example.audio_downloader W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
2021-06-17 03:09:45.642 8822-8855/com.example.audio_downloader D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2021-06-17 03:09:45.643 8822-8855/com.example.audio_downloader D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2021-06-17 03:09:45.645 8822-8855/com.example.audio_downloader D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2021-06-17 03:09:45.747 8822-8822/com.example.audio_downloader W/udio_downloade: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2021-06-17 03:09:45.747 8822-8822/com.example.audio_downloader W/udio_downloade: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2021-06-17 03:09:45.756 8822-8822/com.example.audio_downloader D/AndroidRuntime: Shutting down VM
2021-06-17 03:09:45.758 8822-8822/com.example.audio_downloader E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.audio_downloader, PID: 8822
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.audio_downloader/com.example.audio_downloader.MainActivity}: android.view.InflateException: Binary XML file line #2 in com.example.audio_downloader:layout/activity_main: Binary XML file line #2 in com.example.audio_downloader:layout/activity_main: Error inflating class layout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: android.view.InflateException: Binary XML file line #2 in com.example.audio_downloader:layout/activity_main: Binary XML file line #2 in com.example.audio_downloader:layout/activity_main: Error inflating class layout
Caused by: android.view.InflateException: Binary XML file line #2 in com.example.audio_downloader:layout/activity_main: Error inflating class layout
Caused by: java.lang.ClassNotFoundException: android.view.layout
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at android.view.LayoutInflater.createView(LayoutInflater.java:815)
at android.view.LayoutInflater.createView(LayoutInflater.java:776)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:913)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:68)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:930)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:950)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.inflate(LayoutInflater.java:659)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:699)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at com.example.audio_downloader.MainActivity.onCreate(MainActivity.kt:19)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
2021-06-17 03:09:45.758 8822-8822/com.example.audio_downloader E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.layout" on path: DexPathList[[zip file "/data/app/com.example.audio_downloader-c8ZlMIqksHRCoit9GGx70g==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.audio_downloader-c8ZlMIqksHRCoit9GGx70g==/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 31 more
The code analysis with Android Studio says there are no errors nor warnings in the code.
The dependencies and plugins are as follows:
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "androidx.cardview:cardview:1.0.0"
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.code.gson:gson:2.8.6'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
As I use Picasso and the URL imaging I have added <uses-permission android:name="android.permission.INTERNET" />
to AndroidManifest.xml as well
I have tried using logcat but it seems like the application does not even enter the OnCreate() stage.
The XML file:
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:padding="4dp"
tools:listitem="@layout/item_holder" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
I have tried enabling dataBinding and viewBinding. The kotlin-kapt plugin has also been tried. I've tried using viewBinding instead of kotlinx.synthetic.