Related
I'm running through this tutorial on building an android app with google maps built in. The first run I made was successful, but when I run the same thing successively, it crashes and cannot load.
Included here are the log for the successful run, and from the unsuccessful run:
- a non-exiting runtime exception
- the fatal unimplemented / null object reference exception
- a log about accessing hidden fields that's much longer than the equivalent message in the "correct" log
I'm unsure about what data is necessary, but there's a size limit on these questions, so let me know if there's any other info that could be helpful here.
Successful Launch:
01/01 13:45:52: Launching 'app' on Pixel 4 API 30.
Install successfully finished in 578 ms.
$ adb shell am start -n "com.example.zellishstories/com.example.zellishstories.MapsActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 12703 on device 'Pixel_4_API_30 [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/.zellishstorie: Late-enabling -Xcheck:jni
I/.zellishstorie: Unquickening 12 vdex files!
W/.zellishstorie: Unexpected CPU variant for X86 using defaults: x86
I/.zellishstorie: The ClassLoaderContext is a special shared library.
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
D/MapsInitializer: preferredRenderer: null
D/zzca: preferredRenderer: null
I/zzca: Making Creator dynamically
I/DynamiteModule: Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:201817000
Selected remote version of com.google.android.gms.maps_dynamite, version >= 201817000
V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/.zellishstorie: Unsupported class loader
W/.zellishstorie: Unsupported class loader
I/Google Maps Android API: Google Play services client version: 12451000
D/MapsInitializer: loadedRenderer: LEGACY
D/zzca: preferredRenderer: null
I/Google Maps Android API: Google Play services package version: 201817022
I/TetheringManager: registerTetheringEventCallback:com.example.zellishstories
W/.zellishstorie: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
D/HostConnection: HostConnection::get() New Host Connection established 0xf0c2eae0, tid 12733
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/EGL_emulation: eglCreateContext: 0xf0c2e370: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0xf0c2e370: ver 2 0 (tinfo 0xf0f7d8b0) (first time)
I/Gralloc4: mapper 4.x is not supported
D/HostConnection: createUnique: call
HostConnection::get() New Host Connection established 0xf0c2df10, tid 12733
D/goldfish-address-space: allocate: Ask for block of size 0x100
allocate: ioctl allocate returned offset 0x3f3ffe000 size 0x2000
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2
D/HostConnection: HostConnection::get() New Host Connection established 0xf0c2cf50, tid 12765
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2
D/EGL_emulation: eglCreateContext: 0xf0c2db20: maj 1 min 0 rcv 1
W/Gralloc4: allocator 3.x is not supported
D/EGL_emulation: eglMakeCurrent: 0xf0c2db20: ver 1 0 (tinfo 0xf0f7df70) (first time)
D/EGL_emulation: eglMakeCurrent: 0xf0c2db20: ver 1 0 (tinfo 0xf0f7df70) (first time)
W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4
Selected remote version of com.google.android.gms.googlecertificates, version >= 4
W/.zellishstorie: Unsupported class loader
W/.zellishstorie: Unsupported class loader
Runtime Exception:
W/Resources: Drawable com.example.zellishstories:drawable/abc_ic_voice_search_api_material has unresolved theme attributes! Consider using Resources.getDrawable(int, Theme) or Context.getDrawable(int).
java.lang.RuntimeException
at android.content.res.Resources.getDrawable(Resources.java:899)
at com.google.maps.api.android.lib6.impl.at.e(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):6)
at com.google.maps.api.android.lib6.impl.r.<init>(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):30)
at com.google.maps.api.android.lib6.impl.bi.a(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):19)
at com.google.maps.api.android.lib6.impl.co.a(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):4)
at com.google.android.gms.maps.internal.o.a(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):21)
at cy.onTransact(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):4)
at android.os.Binder.transact(Binder.java:1043)
at com.google.android.gms.internal.maps.zza.zzH(com.google.android.gms:play-services-maps##18.0.0:2)
at com.google.android.gms.maps.internal.zzk.onCreateView(com.google.android.gms:play-services-maps##18.0.0:5)
at com.google.android.gms.maps.zzau.onCreateView(com.google.android.gms:play-services-maps##18.0.0:7)
at com.google.android.gms.dynamic.zad.zab(com.google.android.gms:play-services-base##18.0.0:2)
at com.google.android.gms.dynamic.DeferredLifecycleHelper.zaf(com.google.android.gms:play-services-base##18.0.0:1)
at com.google.android.gms.dynamic.DeferredLifecycleHelper.onCreateView(com.google.android.gms:play-services-base##18.0.0:2)
at com.google.android.gms.maps.SupportMapFragment.onCreateView(com.google.android.gms:play-services-maps##18.0.0:1)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2963)
at androidx.fragment.app.FragmentStateManager.ensureInflatedView(FragmentStateManager.java:386)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:281)
at androidx.fragment.app.FragmentLayoutInflaterFactory.onCreateView(FragmentLayoutInflaterFactory.java:140)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:135)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:319)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:298)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1067)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:995)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.inflate(LayoutInflater.java:657)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at com.example.zellishstories.databinding.ActivityMapsBinding.inflate(ActivityMapsBinding.java:36)
at com.example.zellishstories.databinding.ActivityMapsBinding.inflate(ActivityMapsBinding.java:30)
at com.example.zellishstories.MapsActivity.onCreate(MapsActivity.kt:22)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5456)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5362)
at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:58)
at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:5415)
at android.app.ActivityThread.access$3300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2076)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Fatal Exception:
D/skia: --- Failed to create image decoder with message 'unimplemented'
E/AndroidRuntime: FATAL EXCEPTION: GLThread 809
Process: com.example.zellishstories, PID: 12961
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
at com.google.maps.api.android.lib6.gmm6.vector.gl.aj.a(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):11)
at com.google.maps.api.android.lib6.gmm6.vector.gl.aj.<init>(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):3)
at com.google.maps.api.android.lib6.gmm6.vector.gl.g.<init>(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):23)
at com.google.maps.api.android.lib6.gmm6.vector.bt.b(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):20)
at com.google.maps.api.android.lib6.gmm6.vector.av.run(:com.google.android.gms.dynamite_mapsdynamite#201817052#20.18.17 (040700-0):56)
Weird hidden access note:
Accessing hidden field Ljava/lang/Thread;->EMPTY_STACK_TRACE:[Ljava/lang/StackTraceElement; (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->SUBCLASS_IMPLEMENTATION_PERMISSION:Ljava/lang/RuntimePermission; (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->lock:Ljava/lang/Object; (greylist, linking, allowed)
Accessing hidden field Ljava/lang/Thread;->daemon:Z (greylist, linking, allowed)
Accessing hidden field Ljava/lang/Thread;->stillborn:Z (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->threadLocals:Ljava/lang/ThreadLocal$ThreadLocalMap; (greylist, linking, allowed)
Accessing hidden field Ljava/lang/Thread;->inheritableThreadLocals:Ljava/lang/ThreadLocal$ThreadLocalMap; (greylist, linking, allowed)
Accessing hidden field Ljava/lang/Thread;->systemDaemon:Z (blacklist, linking, denied)
Accessing hidden field Ljava/lang/Thread;->started:Z (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->blockerLock:Ljava/lang/Object; (greylist-max-o, linking, denied)
Accessing hidden method Ljava/lang/Thread;->nextThreadNum()I (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->stillborn:Z (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->systemDaemon:Z (blacklist, linking, denied)
Accessing hidden field Ljava/lang/Thread;->started:Z (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->blockerLock:Ljava/lang/Object; (greylist-max-o, linking, denied)
Accessing hidden method Ljava/lang/Thread;->nextThreadNum()I (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->stillborn:Z (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->systemDaemon:Z (blacklist, linking, denied)
Accessing hidden field Ljava/lang/Thread;->started:Z (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->blockerLock:Ljava/lang/Object; (greylist-max-o, linking, denied)
Accessing hidden method Ljava/lang/Thread;->init(Ljava/lang/ThreadGroup;Ljava/lang/Runnable;Ljava/lang/String;J)V (greylist-max-o, linking, denied)
Accessing hidden method Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;Ljava/security/AccessControlContext;)V (blacklist, linking, denied)
Accessing hidden field Ljava/lang/Thread;->stillborn:Z (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->systemDaemon:Z (blacklist, linking, denied)
Accessing hidden field Ljava/lang/Thread;->started:Z (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->blockerLock:Ljava/lang/Object; (greylist-max-o, linking, denied)
Accessing hidden method Ljava/lang/Thread;->nextThreadNum()I (greylist-max-o, linking, denied)
Accessing hidden field Ljava/lang/Thread;->stillborn:Z (greylist-max-o, linking, denied)
From what is seems in the Fatal Exception where it reads
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
at line 4, you try to get the width of a drawable which is loaded to null (probably an ImageView not defined (correctly) in the xml file).
Can you verify that all Views are defined correctly?
I'm new to android development(just started a few hours ago) and just to see how things work im trying like when button is clicked the text of TextView should change, but the app crashes when it reaches that line. Can anyone please suggest me what changes should I make.
MainActivity.kt
package com.example.ruthvikapplication
import android.os.Bundle
import android.widget.Button
import android.widget.RatingBar
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val button1=findViewById<Button>(R.id.button)
val ratingBar1= findViewById<RatingBar>(R.id.ratingBar)
val title1= findViewById<TextView>(R.id.title)
button1.setOnClickListener{
Toast.makeText(this#MainActivity, "Your rating"+ratingBar1.rating.toString(), Toast.LENGTH_SHORT).show()
title1.text= "Thanks for rating!!" // app crashes here...
}
}
}
activity_main.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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FFCC"
tools:context=".MainActivity">
<TextView
android:id="#+id/myTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:rotationX="33"
android:text="Please rate this app!!"
android:textColor="#FF0000"
android:textSize="34sp"
android:textStyle="bold|italic"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rate"
app:backgroundTint="#FFC800"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/ratingBar"
app:layout_constraintTop_toBottomOf="#+id/myTitle" />
<RatingBar
android:id="#+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:background="#00FFCC"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/myTitle"
tools:ignore="SpeakableTextPresentCheck" />
</androidx.constraintlayout.widget.ConstraintLayout>
The console
09/25 21:43:43: Launching 'app' on Pixel 5 API 30.
Install successfully finished in 4 s 826 ms.
$ adb shell am start -n "com.example.ruthvikapplication/com.example.ruthvikapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 6745 on device 'Pixel_5_API_30 [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
W/System: A resource failed to call close.
W/hvikapplicatio: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
W/hvikapplicatio: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
D/HostConnection: HostConnection::get() New Host Connection established 0xee45b910, tid 6768
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_2
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/EGL_emulation: eglCreateContext: 0xee460760: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0xee460760: ver 2 0 (tinfo 0xee7b43f0) (first time)
I/Gralloc4: mapper 4.x is not supported
D/HostConnection: createUnique: call
D/HostConnection: HostConnection::get() New Host Connection established 0xee461330, tid 6768
D/goldfish-address-space: allocate: Ask for block of size 0x100
D/goldfish-address-space: allocate: ioctl allocate returned offset 0x34dffc000 size 0x2000
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_2
I/Choreographer: Skipped 45 frames! The application may be doing too much work on its main thread.
I/OpenGLRenderer: Davey! duration=792ms; Flags=0, IntendedVsync=1872865754256, Vsync=1873615754226, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1873628675300, AnimationStart=1873628792800, PerformTraversalsStart=1873630847400, DrawStart=1873631928700, SyncQueued=1873632253400, SyncStart=1873637319300, IssueDrawCommandsStart=1873637409900, SwapBuffers=1873651804500, FrameCompleted=1873663434900, DequeueBufferDuration=2445200, QueueBufferDuration=5067700, GpuCompleted=9223372034707292159,
D/CompatibilityChangeReporter: Compat change id reported: 147798919; UID 10121; state: ENABLED
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.ruthvikapplication, PID: 6745
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
at com.example.ruthvikapplication.MainActivity.onCreate$lambda-0(MainActivity.kt:21)
at com.example.ruthvikapplication.MainActivity.$r8$lambda$dEE9GmU9yeAvvuQdJ131D5Xmycc(Unknown Source:0)
at com.example.ruthvikapplication.MainActivity$$ExternalSyntheticLambda0.onClick(Unknown Source:6)
at android.view.View.performClick(View.java:7448)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
at android.view.View.performClickInternal(View.java:7425)
at android.view.View.access$3600(View.java:810)
at android.view.View$PerformClick.run(View.java:28305)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/Process: Sending signal. PID: 6745 SIG: 9
I think the ID of TextView in XML is myTitle which is different from what you are using in Kotlin file i.e. title
Try log.d("TextView", title1.toString());
to check confirm
I am switch from iOS to Android and try to download the image by URL, for this problem I find that a lot of developers prefer to use the Glide library, I am trying to download images but can't understand why I see the error image. Look please on my code and say what I am doing wrong?
This error happens with JPEG and PNG formats.
Glide version 4.12.0
Code:
val urlJpg = "http://developer.alexanderklimov.ru/android/images/android_cat.jpg"
lateinit var img: ImageView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
img = findViewById(R.id.imageView)
Glide.with(this) //1
.load(urlJpg)
.placeholder(R.drawable.ic_launcher_background)
.error(R.drawable.ic_launcher_foreground)
.into(img)
}
Log:
2021-04-01 11:49:04.750 18374-18374/? I/glideandpicass: Not late-enabling -Xcheck:jni (already on)
2021-04-01 11:49:04.828 18374-18374/? I/glideandpicass: Unquickening 12 vdex files!
2021-04-01 11:49:04.832 18374-18374/? W/glideandpicass: Unexpected CPU variant for X86 using defaults: x86
2021-04-01 11:49:05.517 18374-18374/com.example.testglideandpicasso D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2021-04-01 11:49:05.519 18374-18374/com.example.testglideandpicasso D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2021-04-01 11:49:05.593 18374-18404/com.example.testglideandpicasso D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2021-04-01 11:49:05.607 18374-18404/com.example.testglideandpicasso D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2021-04-01 11:49:05.626 18374-18404/com.example.testglideandpicasso D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2021-04-01 11:49:05.984 18374-18374/com.example.testglideandpicasso W/glideandpicass: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2021-04-01 11:49:05.986 18374-18374/com.example.testglideandpicasso W/glideandpicass: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2021-04-01 11:49:06.119 18374-18374/com.example.testglideandpicasso W/Glide: Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a #GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored
2021-04-01 11:49:06.390 18374-18374/com.example.testglideandpicasso W/glideandpicass: Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (greylist,core-platform-api, reflection, allowed)
2021-04-01 11:49:06.390 18374-18374/com.example.testglideandpicasso W/glideandpicass: Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (greylist,core-platform-api, reflection, allowed)
2021-04-01 11:49:06.390 18374-18374/com.example.testglideandpicasso W/glideandpicass: Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (greylist,core-platform-api, reflection, allowed)
2021-04-01 11:49:06.468 18374-18374/com.example.testglideandpicasso W/Glide: Load failed for http://developer.alexanderklimov.ru/android/images/android_cat.jpg with size [1173x746]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There was 1 root cause:
com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
There was 1 root cause:
com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed
There was 1 root cause:
com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: -1
2021-04-01 11:49:06.471 18374-18374/com.example.testglideandpicasso I/Glide: Root cause (1 of 1)
com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: -1
at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:98)
at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:58)
at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311)
at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:280)
at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:235)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
Caused by: java.io.IOException: Cleartext HTTP traffic to developer.alexanderklimov.ru not permitted
at com.android.okhttp.HttpHandler$CleartextURLFilter.checkURLPermitted(HttpHandler.java:127)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:462)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:93)
at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:58)
at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311)
at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:280)
at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:235)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
2021-04-01 11:49:06.514 18374-18402/com.example.testglideandpicasso D/HostConnection: HostConnection::get() New Host Connection established 0xe8eece00, tid 18402
2021-04-01 11:49:06.532 18374-18402/com.example.testglideandpicasso D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0
2021-04-01 11:49:06.582 18374-18402/com.example.testglideandpicasso W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2021-04-01 11:49:06.585 18374-18402/com.example.testglideandpicasso D/EGL_emulation: eglCreateContext: 0xe8eedc70: maj 3 min 0 rcv 3
2021-04-01 11:49:06.594 18374-18402/com.example.testglideandpicasso D/EGL_emulation: eglMakeCurrent: 0xe8eedc70: ver 3 0 (tinfo 0xe923a070) (first time)
2021-04-01 11:49:06.618 18374-18402/com.example.testglideandpicasso I/Gralloc4: mapper 4.x is not supported
2021-04-01 11:49:06.619 18374-18402/com.example.testglideandpicasso D/HostConnection: createUnique: call
2021-04-01 11:49:06.620 18374-18402/com.example.testglideandpicasso D/HostConnection: HostConnection::get() New Host Connection established 0xe8eed570, tid 18402
2021-04-01 11:49:06.621 18374-18402/com.example.testglideandpicasso D/goldfish-address-space: allocate: Ask for block of size 0x100
2021-04-01 11:49:06.621 18374-18402/com.example.testglideandpicasso D/goldfish-address-space: allocate: ioctl allocate returned offset 0x3f7ef4000 size 0x2000
2021-04-01 11:49:06.639 18374-18402/com.example.testglideandpicasso D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0
Glide logs:
2021-04-01 11:49:06.119 18374-18374/com.example.testglideandpicasso W/Glide: Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a #GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored
2021-04-01 11:49:06.468 18374-18374/com.example.testglideandpicasso W/Glide: Load failed for http://developer.alexanderklimov.ru/android/images/android_cat.jpg with size [1173x746]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There was 1 root cause:
com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE
There was 1 root cause:
com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed
There was 1 root cause:
com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: -1
2021-04-01 11:49:06.471 18374-18374/com.example.testglideandpicasso I/Glide: Root cause (1 of 1)
com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: -1
at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:98)
at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:58)
at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311)
at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:280)
at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:235)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
Caused by: java.io.IOException: Cleartext HTTP traffic to developer.alexanderklimov.ru not permitted
at com.android.okhttp.HttpHandler$CleartextURLFilter.checkURLPermitted(HttpHandler.java:127)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:462)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
at com.bumptech.glide.load.data.HttpUrlFetcher.loadDataWithRedirects(HttpUrlFetcher.java:93)
at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:58)
at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:311)
at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:280)
at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:235)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
Adding Network Security Config xml file in manifest
res/xml/network_security_config.xml:
Create the Network security config.xml in resource xml folder.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">developer.alexanderklimov.ru/</domain>
</domain-config>
</network-security-config>
Add the Network security config.xml in manifest like following.
<application
android:name=".MyApplication"
android:networkSecurityConfig="#xml/network_security_config" ... />
I examined the log and try solved my problem using this post Glide showing error: Failed to find GeneratedAppGlideModule
The example above will be good for some situation, but for my problem solution simple need to add allow clear HTTP traffic inside Manifest file.
android:usesCleartextTraffic="true"
All my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testglideandpicasso">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:usesCleartextTraffic="true"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.TestGlideAndPicasso">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I think you're missing INTERNET permission in your AndroidManifest.xml.
Please define permission before application element in AndroidManifest.xml file.
<uses-permission android:name="android.permission.INTERNET" />
Any internet request on Android platform must have this permission, for more permissions, please check android developer documentation: https://developer.android.com/reference/android/Manifest.permission?hl=en
Have a nice trip on your Android development!
Everything was fine until the last Flutter upgrade to beta 2.0.1 (same as current stable I think).
Now I suddenly get this message during init of the firebase messaging.
NoSuchMethodError: No top-level getter '_registerPlugins' declared.
Receiver: top-level
Tried calling: _registerPlugins
This error is triggered by calling:
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
Down the call path this calls:
package: firebase_messaging_platform_interface-1.0.0-dev.10
file : method_channel_messaging.dart:
await channel.invokeMapMethod('Messaging#startBackgroundIsolate', {
'pluginCallbackHandle': bgHandle.toRawHandle(),
'userCallbackHandle': userHandle.toRawHandle(),
});
That ends up in:
package: flutter
file : platform_channel.dart:
final ByteData? result = await binaryMessenger.send(
name,
codec.encodeMethodCall(MethodCall(method, arguments)),
);
Seems like the exception is thrown here...
Those are the messages it generates in my console. Nothing that indicates a problem I think:
I/FLTFireBGExecutor( 8226): Creating background FlutterEngine instance, with args: [--start-paused, --enable-dart-profiling]
D/EGL_emulation( 8226): eglCreateContext: 0xe3b20600: maj 2 min 0 rcv 2
D/EGL_emulation( 8226): eglCreateContext: 0xe3b206c0: maj 2 min 0 rcv 2
D/HostConnection( 8226): HostConnection::get() New Host Connection established 0xc4abc480, tid 8310
D/HostConnection( 8226): HostComposition ext
ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1
ANDROID_EMU_direct_mem
ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2
ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands
ANDROID_EMU_vulkan_null_optional_strings
ANDROID_EMU_vulkan_create_resources_with_requirements
ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer
ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_vulkan_free_memory_sync
ANDROID_EMU_vulkan_shader_float16_int8
ANDROID_EMU_vulkan_async_queue_submit GL_OES_vertex_array_object
GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing
ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_2
D/EGL_emulation( 8226): eglMakeCurrent: 0xe3b206c0: ver 2 0 (tinfo 0xe3bb0b50)
>>> At this moment the exception is thrown <<<
I/FLTFireMsgService( 8226): FlutterFirebaseMessagingBackgroundService started!
Does anybody have any suggestions?
I have just build a project with android kotlin but when I run the app it got crash, and in the logcat I found this error
java.lang.NullPointerException: DataBindingUtil.setConte….layout.activity_chapter) must not be null
ChapterActivity.kt
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.tutorial.kotlinfirebasecomicreader.Common.Common
import com.tutorial.kotlinfirebasecomicreader.Model.Comic
import com.tutorial.kotlinfirebasecomicreader.databinding.ActivityChapterBinding
class ChapterActivity : AppCompatActivity() {
private lateinit var binding: ActivityChapterBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, R.layout.activity_chapter)
binding.toolbar.title = Common.selected_comic!!.Name
binding.toolbar.setNavigationIcon(R.drawable.ic_baseline_chevron_left_24)
binding.toolbar.setNavigationOnClickListener {
finish() //GO BACK
}
binding.recyclerChapter.setHasFixedSize(true)
val layoutManager = LinearLayoutManager(this#ChapterActivity)
binding.recyclerChapter.layoutManager = layoutManager
binding.recyclerChapter.addItemDecoration(DividerItemDecoration(this, layoutManager.orientation))
fetchChapter (Common.selected_comic!!)
}
private fun fetchChapter(comic: Comic) {
Common.chapterList = comic.Chapters!!
binding.txtChapterName.text = StringBuilder("Chapter (")
.append(comic.Chapters!!.size)
.append(")")
}
}
I don't really know how to fix it and I need some help
Edited =>
activity_chapter.xml
<?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">
<data>
</data>
<LinearLayout
android:orientation="vertical"
android:background="#android:color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ChapterActivity">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:minHeight="?attr/actionBarSize"
app:titleTextColor="#color/textColor"
android:background="#color/columnColor"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:orientation="horizontal"
android:padding="16dp"
android:weightSum="4"
android:background="#color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/txt_chapter_name"
android:text="Chapter (10)"
android:textColor="#color/textColor"
android:textSize="20sp"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler_chapter"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</layout>
Stack Trace =>
2021-03-04 11:55:23.033 11911-11911/? I/basecomicreade: Not late-enabling -Xcheck:jni (already on)
2021-03-04 11:55:23.106 11911-11911/? I/basecomicreade: Unquickening 13 vdex files!
2021-03-04 11:55:23.108 11911-11911/? W/basecomicreade: Unexpected CPU variant for X86 using defaults: x86_64
2021-03-04 11:55:23.913 11911-11911/com.tutorial.kotlinfirebasecomicreader W/ComponentDiscovery: Class com.google.firebase.dynamicloading.DynamicLoadingRegistrar is not an found.
2021-03-04 11:55:23.933 11911-11911/com.tutorial.kotlinfirebasecomicreader I/FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]
2021-03-04 11:55:23.957 11911-11911/com.tutorial.kotlinfirebasecomicreader I/FirebaseInitProvider: FirebaseApp initialization successful
2021-03-04 11:55:24.001 11911-11932/com.tutorial.kotlinfirebasecomicreader W/basecomicreade: Unsupported class loader
2021-03-04 11:55:24.010 11911-11932/com.tutorial.kotlinfirebasecomicreader I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:46 and remote module com.google.android.gms.measurement.dynamite:45
2021-03-04 11:55:24.010 11911-11932/com.tutorial.kotlinfirebasecomicreader I/DynamiteModule: Selected local version of com.google.android.gms.measurement.dynamite
2021-03-04 11:55:24.053 11911-11937/com.tutorial.kotlinfirebasecomicreader D/libEGL: loaded /vendor/lib64/egl/libEGL_emulation.so
2021-03-04 11:55:24.055 11911-11937/com.tutorial.kotlinfirebasecomicreader D/libEGL: loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
2021-03-04 11:55:24.062 11911-11937/com.tutorial.kotlinfirebasecomicreader D/libEGL: loaded /vendor/lib64/egl/libGLESv2_emulation.so
2021-03-04 11:55:24.160 11911-11911/com.tutorial.kotlinfirebasecomicreader D/skia: Warning: an opaque image should be decoded as opaque - it is being decoded as non-opaque, which will draw slower
2021-03-04 11:55:24.200 11911-11932/com.tutorial.kotlinfirebasecomicreader V/FA: onActivityCreated
2021-03-04 11:55:24.250 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: App measurement collection enabled
2021-03-04 11:55:24.254 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: App measurement enabled for app package, google app id: com.tutorial.kotlinfirebasecomicreader, 1:705167416733:android:e2429adee28166ea782374
2021-03-04 11:55:24.256 11911-11938/com.tutorial.kotlinfirebasecomicreader I/FA: App measurement initialized, version: 39000
2021-03-04 11:55:24.256 11911-11938/com.tutorial.kotlinfirebasecomicreader I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
2021-03-04 11:55:24.257 11911-11938/com.tutorial.kotlinfirebasecomicreader I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.tutorial.kotlinfirebasecomicreader
2021-03-04 11:55:24.257 11911-11938/com.tutorial.kotlinfirebasecomicreader D/FA: Debug-level message logging enabled
2021-03-04 11:55:24.287 11911-11911/com.tutorial.kotlinfirebasecomicreader W/basecomicreade: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2021-03-04 11:55:24.288 11911-11911/com.tutorial.kotlinfirebasecomicreader W/basecomicreade: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2021-03-04 11:55:24.354 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Connecting to remote service
2021-03-04 11:55:24.420 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Connection attempt already in progress
2021-03-04 11:55:24.476 11911-11935/com.tutorial.kotlinfirebasecomicreader D/HostConnection: HostConnection::get() New Host Connection established 0x7d323924d620, tid 11935
2021-03-04 11:55:24.490 11911-11935/com.tutorial.kotlinfirebasecomicreader D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0
2021-03-04 11:55:24.507 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Connection attempt already in progress
2021-03-04 11:55:24.509 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Activity resumed, time: 57788511
2021-03-04 11:55:24.600 11911-11935/com.tutorial.kotlinfirebasecomicreader D/EGL_emulation: eglCreateContext: 0x7d323924e840: maj 3 min 0 rcv 3
2021-03-04 11:55:24.680 11911-11935/com.tutorial.kotlinfirebasecomicreader D/EGL_emulation: eglMakeCurrent: 0x7d323924e840: ver 3 0 (tinfo 0x7d32392d78c0)
2021-03-04 11:55:24.690 11911-11938/com.tutorial.kotlinfirebasecomicreader I/FA: Tag Manager is not found and thus will not be used
2021-03-04 11:55:24.706 11911-11935/com.tutorial.kotlinfirebasecomicreader I/Gralloc4: mapper 4.x is not supported
2021-03-04 11:55:24.707 11911-11935/com.tutorial.kotlinfirebasecomicreader W/Gralloc3: mapper 3.x is not supported
2021-03-04 11:55:24.712 11911-11935/com.tutorial.kotlinfirebasecomicreader D/HostConnection: createUnique: call
2021-03-04 11:55:24.712 11911-11935/com.tutorial.kotlinfirebasecomicreader D/HostConnection: HostConnection::get() New Host Connection established 0x7d323924eac0, tid 11935
2021-03-04 11:55:24.713 11911-11935/com.tutorial.kotlinfirebasecomicreader D/eglCodecCommon: allocate: Ask for block of size 0x100
2021-03-04 11:55:24.713 11911-11935/com.tutorial.kotlinfirebasecomicreader D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3fe042000 size 0x2000
2021-03-04 11:55:24.716 11911-11935/com.tutorial.kotlinfirebasecomicreader D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0
2021-03-04 11:55:24.730 11911-11935/com.tutorial.kotlinfirebasecomicreader D/EGL_emulation: eglMakeCurrent: 0x7d323924e840: ver 3 0 (tinfo 0x7d32392d78c0)
2021-03-04 11:55:24.795 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Connection attempt already in progress
2021-03-04 11:55:24.797 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Connection attempt already in progress
2021-03-04 11:55:25.306 11911-11935/com.tutorial.kotlinfirebasecomicreader I/OpenGLRenderer: Davey! duration=900ms; Flags=1, IntendedVsync=57788545708266, Vsync=57788579041598, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=57788595779340, AnimationStart=57788595852830, PerformTraversalsStart=57788595904150, DrawStart=57788869782150, SyncQueued=57788872423620, SyncStart=57788883887770, IssueDrawCommandsStart=57788884972440, SwapBuffers=57789368117580, FrameCompleted=57789457618760, DequeueBufferDuration=307500, QueueBufferDuration=1103560, GpuCompleted=0,
2021-03-04 11:55:25.576 11911-11938/com.tutorial.kotlinfirebasecomicreader D/FA: Connected to remote service
2021-03-04 11:55:25.577 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Processing queued up service tasks: 5
2021-03-04 11:55:27.569 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Recording user engagement, ms: 3024
2021-03-04 11:55:27.599 11911-11932/com.tutorial.kotlinfirebasecomicreader V/FA: onActivityCreated
2021-03-04 11:55:27.787 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Activity paused, time: 57791583
2021-03-04 11:55:27.924 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Activity resumed, time: 57792074
2021-03-04 11:55:27.986 11911-11946/com.tutorial.kotlinfirebasecomicreader D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2021-03-04 11:55:27.994 11911-11911/com.tutorial.kotlinfirebasecomicreader E/RecyclerView: No adapter attached; skipping layout
2021-03-04 11:55:28.090 11911-11946/com.tutorial.kotlinfirebasecomicreader W/basecomicreade: Verification of java.util.Set com.android.org.conscrypt.SSLUtils.getSupportedClientKeyTypes(byte[], int[]) took 100.226ms (648.53 bytecodes/s) (3304B approximate peak alloc)
2021-03-04 11:55:28.260 11911-11935/com.tutorial.kotlinfirebasecomicreader D/EGL_emulation: eglMakeCurrent: 0x7d323924e840: ver 3 0 (tinfo 0x7d32392d78c0)
2021-03-04 11:55:28.732 11911-11946/com.tutorial.kotlinfirebasecomicreader W/basecomicreade: Verification of boolean com.android.org.conscrypt.CertBlacklistImpl.isHex(java.lang.String) took 124.689ms (288.72 bytecodes/s) (2168B approximate peak alloc)
2021-03-04 11:55:28.836 11911-11911/com.tutorial.kotlinfirebasecomicreader I/Choreographer: Skipped 51 frames! The application may be doing too much work on its main thread.
2021-03-04 11:55:28.880 11911-11930/com.tutorial.kotlinfirebasecomicreader I/basecomicreade: Waiting for a blocking GC ProfileSaver
2021-03-04 11:55:28.887 11911-11930/com.tutorial.kotlinfirebasecomicreader I/basecomicreade: WaitForGcToComplete blocked ProfileSaver on RunEmptyCheckpoint for 7.720ms
2021-03-04 11:55:29.270 11911-11935/com.tutorial.kotlinfirebasecomicreader I/OpenGLRenderer: Davey! duration=1239ms; Flags=0, IntendedVsync=57792137367431, Vsync=57792987367397, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=57792988665860, AnimationStart=57792988801340, PerformTraversalsStart=57792989546070, DrawStart=57792989762430, SyncQueued=57792990250570, SyncStart=57792999374600, IssueDrawCommandsStart=57792999429610, SwapBuffers=57793072211200, FrameCompleted=57793385836850, DequeueBufferDuration=20442430, QueueBufferDuration=76115660, GpuCompleted=77309411328,
2021-03-04 11:55:29.691 11911-11935/com.tutorial.kotlinfirebasecomicreader D/EGL_emulation: eglMakeCurrent: 0x7d323924e840: ver 3 0 (tinfo 0x7d32392d78c0)
2021-03-04 11:55:29.792 11911-11935/com.tutorial.kotlinfirebasecomicreader I/OpenGLRenderer: Davey! duration=1803ms; Flags=1, IntendedVsync=57792137367431, Vsync=57792987367397, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=57792988665860, AnimationStart=57792988801340, PerformTraversalsStart=57792989546070, DrawStart=57793838734440, SyncQueued=57793840519500, SyncStart=57793843650750, IssueDrawCommandsStart=57793843800190, SwapBuffers=57793936524990, FrameCompleted=57793943762960, DequeueBufferDuration=82930, QueueBufferDuration=274660, GpuCompleted=8810055295132672,
2021-03-04 11:55:29.797 11911-11911/com.tutorial.kotlinfirebasecomicreader I/Choreographer: Skipped 57 frames! The application may be doing too much work on its main thread.
2021-03-04 11:55:29.887 11911-11935/com.tutorial.kotlinfirebasecomicreader D/EGL_emulation: eglMakeCurrent: 0x7d323924e840: ver 3 0 (tinfo 0x7d32392d78c0)
2021-03-04 11:55:30.096 11911-11935/com.tutorial.kotlinfirebasecomicreader I/OpenGLRenderer: Davey! duration=1062ms; Flags=0, IntendedVsync=57792995727619, Vsync=57793945727581, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=57793949431810, AnimationStart=57793949481480, PerformTraversalsStart=57793952149640, DrawStart=57793952476430, SyncQueued=57793953226090, SyncStart=57794142461760, IssueDrawCommandsStart=57794149759670, SwapBuffers=57794236027780, FrameCompleted=57794247497260, DequeueBufferDuration=296420, QueueBufferDuration=1234510, GpuCompleted=137654660947320,
2021-03-04 11:55:30.221 11911-11935/com.tutorial.kotlinfirebasecomicreader D/EGL_emulation: eglMakeCurrent: 0x7d323924e840: ver 3 0 (tinfo 0x7d32392d78c0)
2021-03-04 11:55:30.455 11911-11935/com.tutorial.kotlinfirebasecomicreader I/OpenGLRenderer: Davey! duration=1270ms; Flags=0, IntendedVsync=57792995727619, Vsync=57793945727581, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=57793949431810, AnimationStart=57793949481480, PerformTraversalsStart=57793952149640, DrawStart=57794142711790, SyncQueued=57794142809910, SyncStart=57794483167180, IssueDrawCommandsStart=57794483392980, SwapBuffers=57794595122060, FrameCompleted=57794606716760, DequeueBufferDuration=131380, QueueBufferDuration=409730, GpuCompleted=137657109016869,
2021-03-04 11:55:30.456 11911-11935/com.tutorial.kotlinfirebasecomicreader D/EGL_emulation: eglMakeCurrent: 0x7d323924e840: ver 3 0 (tinfo 0x7d32392d78c0)
2021-03-04 11:55:30.511 11911-11911/com.tutorial.kotlinfirebasecomicreader D/Slider: onImageSlideChange() called with: position = [0]
2021-03-04 11:55:30.511 11911-11911/com.tutorial.kotlinfirebasecomicreader I/SlideIndicatorsGroup: onSlideChange: 0
2021-03-04 11:55:30.515 11911-11911/com.tutorial.kotlinfirebasecomicreader I/SlideIndicatorsGroup: onSlideChange: 0
2021-03-04 11:55:30.525 11911-11911/com.tutorial.kotlinfirebasecomicreader I/Choreographer: Skipped 42 frames! The application may be doing too much work on its main thread.
2021-03-04 11:55:30.608 11911-11911/com.tutorial.kotlinfirebasecomicreader W/basecomicreade: Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (greylist,core-platform-api, reflection, allowed)
2021-03-04 11:55:30.608 11911-11911/com.tutorial.kotlinfirebasecomicreader W/basecomicreade: Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (greylist,core-platform-api, reflection, allowed)
2021-03-04 11:55:30.608 11911-11911/com.tutorial.kotlinfirebasecomicreader W/basecomicreade: Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (greylist,core-platform-api, reflection, allowed)
2021-03-04 11:55:30.718 11911-11935/com.tutorial.kotlinfirebasecomicreader D/EGL_emulation: eglMakeCurrent: 0x7d323924e840: ver 3 0 (tinfo 0x7d32392d78c0)
2021-03-04 11:55:31.073 11911-11935/com.tutorial.kotlinfirebasecomicreader I/OpenGLRenderer: Davey! duration=1118ms; Flags=1, IntendedVsync=57793962375754, Vsync=57794662375726, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=57794676994830, AnimationStart=57794677072830, PerformTraversalsStart=57794677609830, DrawStart=57794835905760, SyncQueued=57794837936740, SyncStart=57794982254730, IssueDrawCommandsStart=57794985287860, SwapBuffers=57795092878620, FrameCompleted=57795224849780, DequeueBufferDuration=215540, QueueBufferDuration=11529020, GpuCompleted=0,
2021-03-04 11:55:33.429 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Inactivity, disconnecting from the service
2021-03-04 11:55:35.432 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Recording user engagement, ms: 7288
2021-03-04 11:55:35.455 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Connecting to remote service
2021-03-04 11:55:35.460 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Activity paused, time: 57799379
2021-03-04 11:55:35.589 11911-11932/com.tutorial.kotlinfirebasecomicreader V/FA: onActivityCreated
2021-03-04 11:55:35.668 11911-11911/com.tutorial.kotlinfirebasecomicreader D/AndroidRuntime: Shutting down VM
2021-03-04 11:55:35.669 11911-11911/com.tutorial.kotlinfirebasecomicreader E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tutorial.kotlinfirebasecomicreader, PID: 11911
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tutorial.kotlinfirebasecomicreader/com.tutorial.kotlinfirebasecomicreader.ChapterActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3344)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3488)
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:2049)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7506)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.intern
2021-03-04 11:55:35.782 11911-11938/com.tutorial.kotlinfirebasecomicreader V/FA: Connection attempt already in progress
The documentation says that DataBindingUtil.setContentView returns:
The binding associated with the inflated content view or null if the layoutId is not a data binding layout.
So I would have to assume that your layout is not a valid data binding layout, so the issue lies in your XML.
I would recommend reading: Binding expressions which shows you the syntax of a valid binding layout and also this: Data Binding Library fully to help get a comprehensive understanding.
Also the answer by #Teo does point out the recommended way to use data binding so unless you have a specific reason for using the generic version I would switch to that.
Can try to avoid using DataBindingUtil as it keeps return null in my case.
You can try using its own databinding.inflate, as it will always get the correct binding.
binding = ActivityChapterBinding.inflate(layoutInflater)
setContentView(binding.root)
This might sound dumb, but in my case, this happened after renaming a package
and I forgot to clean the project, if databinding refuses to detect the new package name, according to this answer try to disable databinding in Build.gradle (Module), sync then re-enable it
And if you're using google-services, you'll need to adjust the naming part for the google-services.json as well.