Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: How to fix release crash #186

Open
1 task done
MitsuraIvan opened this issue Feb 21, 2024 · 4 comments
Open
1 task done

[Question]: How to fix release crash #186

MitsuraIvan opened this issue Feb 21, 2024 · 4 comments
Labels

Comments

@MitsuraIvan
Copy link

Documentation

  • I've checked the guide, but I didn't find the information I needed there.

Question

gradle wrapper:
distributionUrl=https://services.gradle.org/distributions/gradle-8.3-bin.zip

project build.gradle:

dependencies {
    classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
    classpath('com.android.tools.build:gradle:8.2.2')
    classpath "gradle.plugin.com.wiredforcode:gradle-spawn-plugin:0.8.2"
    classpath 'com.google.gms:google-services:4.4.1'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
}

proguard:

pushwoosh

-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public ;
}
-keep class com.pushwoosh.
* { ; }
-keep class com.arellomobile.
* { ; }
-dontwarn com.pushwoosh.
*
-dontwarn com.arellomobile.**

build.gradle

mBuildToolsVersion=34.0.0
mTargetSdkVersion=34
mCompileSdkVersion=34
mMinSdkVersion=23

//pushwoosh
def mPushWoosh = "6.7.4"
implementation "com.pushwoosh:pushwoosh:$mPushWoosh"
implementation "com.pushwoosh:pushwoosh-inbox:$mPushWoosh"
implementation "com.pushwoosh:pushwoosh-inbox-ui:$mPushWoosh"
implementation "com.pushwoosh:pushwoosh-firebase:$mPushWoosh"
implementation "com.google.firebase:firebase-messaging:23.4.1"
implementation "com.google.firebase:firebase-iid:21.1.0"

error(release signed app only):

Process: x.x.x PID: 12457
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/pushwoosh/inbox/ui/databinding/PwFragmentInboxBinding;
at com.pushwoosh.inbox.ui.presentation.view.fragment.InboxFragment.onCreateView(InboxFragment.kt:7)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:20)
at androidx.fragment.app.t.f(FragmentStateManager.java:189)
at androidx.fragment.app.t.m(FragmentStateManager.java:117)
at androidx.fragment.app.n.d0(FragmentManager.java:278)
at androidx.fragment.app.n.d1(FragmentManager.java:85)
at androidx.fragment.app.n.a0(FragmentManager.java:22)
at androidx.fragment.app.n.S(FragmentManager.java:43)
at androidx.fragment.app.n.y(FragmentManager.java:12)
at androidx.fragment.app.i.c(FragmentController.java:5)
at androidx.fragment.app.e.onStart(FragmentActivity.java:21)
at androidx.appcompat.app.d.onStart(AppCompatActivity.java:1)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1582)
at android.app.Activity.performStart(Activity.java:8628)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3807)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:225)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:205)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:177)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.ClassNotFoundException: com.pushwoosh.inbox.ui.databinding.PwFragmentInboxBinding
at com.pushwoosh.inbox.ui.presentation.view.fragment.InboxFragment.onCreateView(InboxFragment.kt:7) 
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:20) 
at androidx.fragment.app.t.f(FragmentStateManager.java:189) 
at androidx.fragment.app.t.m(FragmentStateManager.java:117) 
at androidx.fragment.app.n.d0(FragmentManager.java:278) 
at androidx.fragment.app.n.d1(FragmentManager.java:85) 
at androidx.fragment.app.n.a0(FragmentManager.java:22) 
at androidx.fragment.app.n.S(FragmentManager.java:43) 
at androidx.fragment.app.n.y(FragmentManager.java:12) 
at androidx.fragment.app.i.c(FragmentController.java:5) 
at androidx.fragment.app.e.onStart(FragmentActivity.java:21) 
at androidx.appcompat.app.d.onStart(AppCompatActivity.java:1) 
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1582) 
at android.app.Activity.performStart(Activity.java:8628) 
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3807) 
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:225) 
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:205) 
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:177) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loopOnce(Looper.java:205) 
at android.os.Looper.loop(Looper.java:294) 
at android.app.ActivityThread.main(ActivityThread.java:8177) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) 

@enginseer-dev
Copy link

Hello, @MitsuraIvan

Based on the error you've described, it seems that the PwFragmentInboxBinding class is being stripped out during the build process, which leads to the NoClassDefFoundError in your release build.
To resolve this, you can add the following ProGuard rules to your project's proguard-rules.pro file:

-keep class com.pushwoosh.inbox.ui.** { *; }
-keep class com.pushwoosh.inbox.ui.databinding.PwFragmentInboxBinding {
    public protected *;
}

Please try adding these rules to your ProGuard configuration and let us know if the issue persists.

@MitsuraIvan
Copy link
Author

Hi, yes, issue still there, same class.
Thru try/error, I found, that adding this line to module with pushwoosh

buildFeatures {
    viewBinding = true
}

fixes issue, seems like error message is misleading and pushwoosh needs viewBindings enabled inside module, thank you for the help anyways :)

@wfhm
Copy link
Member

wfhm commented Feb 27, 2024

@MitsuraIvan

I found, that adding this line to module with pushwoosh

buildFeatures {
viewBinding = true
}

Could you please elaborate on this? This line is already added to build.gradle of pushwoosh-inbox-ui module, and viewBindings are not used in any other module of our SDK. Could you please let me know to build.gradle of what particular module did you have to add this line?

@MitsuraIvan
Copy link
Author

MitsuraIvan commented Feb 27, 2024

I have flutter app, with android project, basically, containing nothing, one base module that starts flutter activity + external sdk's activities, like zendesk chat and pushwoosh inbox, added buildFeatures{...} to main and only android module.

from notable stuff, I also have there

kotlinOptions {
    jvmTarget = '1.8'
}
packagingOptions {
    resources {
        excludes += '/META-INF/{AL2.0,LGPL2.1}'
    }
    exclude 'META-INF/main.kotlin_module'
    exclude 'META-INF/atomicfu.kotlin_module'
}

firebase analytics + multidex + zendesk + pushwoosh + appsflyer + android lifecycle

gradle.properties

org.gradle.jvmargs=-Xmx16g -XX:MaxMetaspaceSize=16g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
android.enableR8.fullMode=false
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
android.nonTransitiveRClass=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants