cookie-information / android-release

0 stars 3 forks source link

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method #51

Open azharsprinting opened 7 months ago

azharsprinting commented 7 months ago

I had successfully run the sample project with my credentials, and Then I Implemented this into my project, it is initialized successfully, but when clicking the button to show consent it gives me this error.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.drawable.Drawable.setTintList(android.content.res.ColorStateList)' on a null object reference at com.cookieinformation.mobileconsents.ui.PreferenceItemViewHolder.(PrivacyPreferencesListAdapter.kt:113) at com.cookieinformation.mobileconsents.ui.PrivacyPreferencesListAdapter.onCreateViewHolder(PrivacyPreferencesListAdapter.kt:52) at com.cookieinformation.mobileconsents.ui.PrivacyPreferencesListAdapter.onCreateViewHolder(PrivacyPreferencesListAdapter.kt:24)

I copied everything from the sample app to my project, it is working in sample app but not in my project.

HannahShulman commented 7 months ago

Hello, Thank you for reaching out. Can you please confirm the following: -What version are you using? -Are you using a custom view? -If you are using your custom view, and you are adding switchComponent, what UI library are you using? -Also, is the attached for the full stack?

Thanks Hanna

azharsprinting commented 7 months ago

Hello, I have created a new project and successfully implemented this SDK as mentioned in the sample, but on implementing the same in my current project, It again gives me this error.

1 - I am using latest version 2.0.7

2 - No, I am not using a custom view.

3 - No, the Full stack is as follows, Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.drawable.Drawable.setTintList(android.content.res.ColorStateList)' on a null object reference at com.cookieinformation.mobileconsents.ui.PreferenceItemViewHolder.(PrivacyPreferencesListAdapter.kt:113) at com.cookieinformation.mobileconsents.ui.PrivacyPreferencesListAdapter.onCreateViewHolder(PrivacyPreferencesListAdapter.kt:52) at com.cookieinformation.mobileconsents.ui.PrivacyPreferencesListAdapter.onCreateViewHolder(PrivacyPreferencesListAdapter.kt:24) at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7295) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6416) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6300) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6296) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2330) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1631) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1591) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:668) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4309) at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3686) at android.view.View.measure(View.java:26380) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608) at android.widget.LinearLayout.measureVertical(LinearLayout.java:878) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:26380) at androidx.recyclerview.widget.RecyclerView$LayoutManager.measureChildWithMargins(RecyclerView.java:9681) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1657) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1591) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:668) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4309) at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3686) at android.view.View.measure(View.java:26380) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608) at android.widget.LinearLayout.measureVertical(LinearLayout.java:878) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:26380) at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1442) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.widget.ScrollView.onMeasure(ScrollView.java:458) at android.view.View.measure(View.java:26380) at androidx.constraintlayout.widget.ConstraintLayout$Measurer.measure(ConstraintLayout.java:811) at androidx.constraintlayout.core.widgets.ConstraintWidgetContainer.measure(ConstraintWidgetContainer.java:632) at androidx.constraintlayout.core.widgets.ConstraintWidgetContainer.layout(ConstraintWidgetContainer.java:733) at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.solveLinearSystem(BasicMeasure.java:160) at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.solverMeasure(BasicMeasure.java:291) at androidx.constraintlayout.core.widgets.ConstraintWidgetContainer.measure(ConstraintWidgetContainer.java:120) at androidx.constraintlayout.widget.ConstraintLayout.resolveSystem(ConstraintLayout.java:1594) at androidx.constraintlayout.widget.ConstraintLayout.onMeasure(ConstraintLayout.java:1708) at android.view.View.measure(View.java:26380) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:26380) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:26380) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145) at android.view.View.measure(View.java:26380) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608) at android.widget.LinearLayout.measureVertical(LinearLayout.java:878) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:26380) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:26380) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608) at android.widget.LinearLayout.measureVertical(LinearLayout.java:878) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:26380) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:760) at android.view.View.measure(View.java:26380) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:4021) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2637) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2943) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2350) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9194) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1231) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239) at android.view.Choreographer.doCallbacks(Choreographer.java:899) at android.view.Choreographer.doFrame(Choreographer.java:832) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7884) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

is this conflicting with any library in our project?

azharsprinting commented 7 months ago

@HannahShulman We are using the following libraries implementation "androidx.core:core-ktx:1.12.0" implementation "androidx.appcompat:appcompat:1.6.1" implementation "com.google.android.material:material:1.11.0" implementation "androidx.constraintlayout:constraintlayout:2.1.4"

implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0" implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.7.0" implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.7.0"

implementation "androidx.cardview:cardview:1.0.0" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3" implementation "androidx.fragment:fragment-ktx:1.6.2" implementation "com.android.support:multidex:1.0.1"

implementation "org.jetbrains.anko:anko:0.10.8" implementation "org.koin:koin-android:2.0.1" implementation "com.squareup.moshi:moshi-kotlin:1.8.0" kapt("com.squareup.moshi:moshi-kotlin-codegen:1.8.0")

implementation "com.google.android.gms:play-services-location:21.0.1" implementation "com.google.android.gms:play-services-maps:18.1.0" implementation "com.google.android.gms:play-services-vision:20.1.3" implementation "com.google.android.gms:play-services-vision-common:19.1.3" implementation "com.google.android.gms:play-services-vision-image-label:18.1.1"

implementation "com.google.firebase:firebase-analytics-ktx:21.2.0" implementation "com.google.firebase:firebase-firestore:21.0.0" implementation "com.google.firebase:firebase-firestore-ktx:21.0.0" implementation "com.google.firebase:firebase-crashlytics-ktx:18.3.1" implementation "com.google.firebase:firebase-dynamic-links:19.1.0" implementation "com.google.firebase:firebase-ml-vision:24.1.0" implementation "com.google.firebase:firebase-ml-model-interpreter:22.0.4"

implementation "io.grpc:grpc-okhttp:1.32.2"

implementation "com.asosyalbebe:moment4j:1.0.0"

implementation("com.squareup.retrofit2:retrofit:2.9.0") { exclude module: 'okhttp' exclude module: 'okhttp3' } implementation "com.squareup.retrofit2:converter-gson:2.9.0" implementation "com.squareup.retrofit2:converter-scalars:2.9.0" implementation "com.squareup.okhttp3:okhttp:4.10.0" implementation "com.squareup.okhttp3:logging-interceptor:4.10.0" implementation "io.jsonwebtoken:jjwt:0.9.1" implementation "com.squareup.retrofit2:converter-moshi:2.9.0"

implementation "com.github.bumptech.glide:glide:4.13.2" kapt "com.github.bumptech.glide:compiler:4.11.0" implementation "com.github.bumptech.glide:okhttp3-integration:4.5.0" implementation("com.github.bumptech.glide:recyclerview-integration:4.5.0") { transitive = false }

implementation "org.permissionsdispatcher:permissionsdispatcher:4.3.0" kapt "org.permissionsdispatcher:permissionsdispatcher-processor:4.3.0"

implementation "com.github.moxy-community:moxy:2.2.1" kapt "com.github.moxy-community:moxy-compiler:2.2.1" implementation "com.github.moxy-community:moxy-androidx:2.2.1" implementation "com.github.moxy-community:moxy-material:2.2.1" implementation "com.github.moxy-community:moxy-ktx:2.2.1"

implementation "eu.davidea:flexible-adapter:5.1.0"

implementation "com.afollestad.material-dialogs:core:3.3.0"

implementation "com.github.arimorty:floatingsearchview:2.1.1" implementation "com.github.ybq:Android-SpinKit:1.2.0" implementation "com.yqritc:recyclerview-flexibledivider:1.4.0"

implementation "com.andkulikov:transitionseverywhere:2.0.0" implementation "ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:1.0.6" implementation "com.airbnb.android:lottie:6.4.0"

implementation "com.google.maps.android:android-maps-utils:2.2.0"

implementation "com.google.android.gms:play-services-flags:18.0.1" implementation "com.otaliastudios:cameraview:2.7.2"

implementation "com.google.android.play:app-update:2.1.0" implementation "com.google.android.play:app-update-ktx:2.1.0"

implementation "com.tjek.sdk:android-sdk:6.0.2"

implementation "zendesk.messaging:messaging-android:2.13.0" implementation("com.zendesk:support:5.1.0") { exclude group: 'com.zendesk', module: 'messaging' } implementation("com.zendesk:answerbot:3.0.9") { exclude group: 'com.zendesk', module: 'messaging' }

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20" implementation "org.jetbrains.kotlin:kotlin-reflect:1.8.20"

implementation "com.google.code.gson:gson:2.10.1" implementation "com.android.support:support-annotations:28.0.0"

implementation "com.google.zxing:core:3.4.1" implementation "com.journeyapps:zxing-android-embedded:3.4.0@aar"

implementation "com.facebook.android:facebook-android-sdk:9.0.0"

implementation "com.algolia:algoliasearch-android:3.27.0" implementation "com.algolia.instantsearch-android:insights:3.0.0"

implementation "net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:3.0.0-RC3"

dImplementation "com.github.chuckerteam.chucker:library:3.5.2" pImplementation "com.github.chuckerteam.chucker:library-no-op:3.5.2"

implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:11.0.1'

implementation "androidx.datastore:datastore-preferences:1.0.0"

implementation "androidx.work:work-runtime-ktx:2.9.0"

implementation "com.emarsys:emarsys-sdk:3.7.3" implementation "com.emarsys:emarsys-firebase:3.7.3"

HannahShulman commented 7 months ago

@azharsprinting Thank you for your info, I will look into this. Can I assume you are setting the SDK color?

azharsprinting commented 7 months ago

Yes I am using the default color that is used in sample for testing

azharsprinting commented 7 months ago

@HannahShulman please comment on this