Add helpshift question

Hello defold team
I try to add helpshift (Getting Started | Helpshift Developer Guide). But when I call function showConversation или showFAQs - crash
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;

I try add android.support.v7.app; but its cant find

Does anyone know how fix this issue ?

Are you creating a HelpShift extension of your own or are you using an existing one? If so, which one? Does you Helpshift extension have a build.gradle file which includes appcompat as mentioned in the docs you linked?

In general the Android support library (AppCompat) is not recommended for use by Google. Instead Google recommends that developers should use AndroidX. Defold uses AndroidX by default, but if you really don’t want to use it you can disable it:

Note that most extensions use AndroidX so by disabling it in your app those other extensions will probably not work.

I noticed that HelpShift is still using the old Android support library. I wonder why they aren’t updating?

3 Likes

My own extension with build.gradle

dependencies {
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.helpshift:helpshift-sdkx:10.2.2'
}

Please verify two things:

  1. Are you using an app manifest file? And if so, can you please verify that “Use Android Support Lib” is NOT checked: Native extensions - Build variants
  2. Please verify that the “Target SDK Version” in game.project is 28 or higher.

If you do have Target SDK Version set to 28 or higher and if you have not checked “Use Android Support Lib”, then Gradle should automatically migrate the HelpShift library to use Android X. Exactly as described here:

“Target SDK Version” is 33, “Use Android Support Lib” not checked

file gradle.properties

android.useAndroidX=true
android.enableJetifier=true

but HelpShift library not to use Android X

crash still exists
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;

You do not need to add this yourself. We do it on the build server if you use AndroidX (the default):

And the setting should be enabled by default. BUT now that I look at the code I see it as the default in the template.appmanifest in the editor:

This file is used when you create a .appmanifest file from the editor, but I don’t see that we default to using Jetifier if you don’t have an appmanifest file.

Ok, try this:

  • Create a foobar.appmanifest (File->New->App Manifest)
  • Leave everything as default
  • Use foobar.appmanifest in game.project Native Extension → App Manifest
  • Rebuild!

Does this work?

repository with my extension https://github.com/gamedevshttl/helpshiftext
in appmanifest “jetifier: true” in armv7-android and arm64-android nodes

error when call Helpshift.install

Rejecting re-init on previously-failed class java.lang.Class<com.helpshift.activities.HSMainActivity>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;
at boolean com.helpshift.util.ApplicationUtil.isApplicationInDebugMode(android.content.Context) (ApplicationUtil.java:28)
at void com.helpshift.Helpshift$4.run() (Helpshift.java:166)
at void com.helpshift.util.SafeWrappedRunnable.run() (SafeWrappedRunnable.java:20)
at java.lang.Object java.util.concurrent.Executors$RunnableAdapter.call() (Executors.java:459)
at void java.util.concurrent.FutureTask.run() (FutureTask.java:266)
at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1167)
at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:641)

if add lib - android-support-v7-appcompat.jar
and in java file add import android.support.v7.app.AppCompatActivity;
error when call Helpshift.install

Rejecting re-init on previously-failed class java.lang.Class<android.support.v7.app.AppCompatActivity>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/FragmentActivity;
at boolean com.helpshift.util.ApplicationUtil.isApplicationInDebugMode(android.content.Context) (ApplicationUtil.java:28)
at void com.helpshift.Helpshift$4.run() (Helpshift.java:166)
at void com.helpshift.util.SafeWrappedRunnable.run() (SafeWrappedRunnable.java:20)
at java.lang.Object java.util.concurrent.Executors$RunnableAdapter.call() (Executors.java:459)
at void java.util.concurrent.FutureTask.run() (FutureTask.java:266)
at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1167)
at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:641)
at void java.lang.Thread.run() (Thread.java:764)

if add lib android-support-v4.jar - build error

Error in /tmp/job4827484569690883035/upload/helpshift/lib/android/android-support-v4.jar:android/support/v4/media/MediaBrowserCompat$CallbackHandler.class:
Type android.support.v4.media.MediaBrowserCompat$CallbackHandler is defined multiple times: /tmp/job4827484569690883035/upload/helpshift/lib/android/android-support-v4.jar:android/support/v4/media/MediaBrowserCompat$CallbackHandler.class, /tmp/.gradle/unpacked/androidx.media-media-1.0.0.aar/classes.jar:android/support/v4/media/MediaBrowserCompat$CallbackHandler.class
Compilation failed
Exception in thread “main” java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /tmp/job4827484569690883035/upload/helpshift/lib/android/android-support-v4.jar:android/support/v4/media/MediaBrowserCompat$CallbackHandler.class
at com.android.tools.r8.utils.w.a(SourceFile:92)
at com.android.tools.r8.D8.main(D8.java:4)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /tmp/job4827484569690883035/upload/helpshift/lib/android/android-support-v4.jar:android/support/v4/media/MediaBrowserCompat$CallbackHandler.class
at Version.fakeStackEntry(Version_3.0.41-sc03.java:0)
at com.android.tools.r8.utils.w.a(SourceFile:68)
at com.android.tools.r8.utils.w.a(SourceFile:28)
at com.android.tools.r8.utils.w.a(SourceFile:27)
at com.android.tools.r8.utils.w.b(SourceFile:3)
at com.android.tools.r8.D8.a(D8.java:17)
at com.android.tools.r8.D8.a(D8.java:15)
at com.android.tools.r8.utils.w.a(SourceFile:84)
… 1 more
Caused by: com.android.tools.r8.internal.b: Type android.support.v4.media.MediaBrowserCompat$CallbackHandler is defined multiple times: /tmp/job4827484569690883035/upload/helpshift/lib/android/android-support-v4.jar:android/support/v4/media/MediaBrowserCompat$CallbackHandler.class, /tmp/.gradle/unpacked/androidx.media-media-1.0.0.aar/classes.jar:android/support/v4/media/MediaBrowserCompat$CallbackHandler.class
at com.android.tools.r8.internal.TA.a(SourceFile:14)
at com.android.tools.r8.internal.TA.a(SourceFile:22)
at com.android.tools.r8.internal.Ew.b(SourceFile:6)
at com.android.tools.r8.internal.Ew.a(SourceFile:23)
at com.android.tools.r8.internal.Ew.a(SourceFile:10)
at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
at com.android.tools.r8.internal.Ew.a(SourceFile:6)
at com.android.tools.r8.graph.I0$c.f(SourceFile:3)
at com.android.tools.r8.dex.a.a(SourceFile:94)
at com.android.tools.r8.dex.a.a(SourceFile:23)
at com.android.tools.r8.D8.a(D8.java:21)
at com.android.tools.r8.D8.d(D8.java:6)
at com.android.tools.r8.D8.c(D8.java:1)
at com.android.tools.r8.utils.w.a(SourceFile:24)

when call Helpshift.showFAQs crash still exists

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;

I just made a new project,

  • copy/paste helpshiftt folder from your repo
  • bundle it
  • install on my phone
  • call helpshift.initialize()
  • it just works:
2023-06-28 12:05:13.024 23198-23223 defold                  com.example.todo                     I  INFO:HELPSHIFT: Helpshift Initialize
2023-06-28 12:05:13.027 23198-23242 Helpshift_Migrator      com.example.todo                     D  Migration not required, skipping
2023-06-28 12:05:13.030 23198-23223 defold                  com.example.todo                     I  INFO:HELPSHIFT: Helpshift Initialize end

So, now I wanna know what is your defold version and what extender you are using in this case?

1 Like

can you try to call ShowConversation() func ?

So, now I wanna know what is your defold version

1.4.4

What about extender?

It works just fine

can you push this project on github ?

What about extender?

where can i find the version ?

For me, it’s enough to know the URL

or if you use your own, just let me know about it

https://build.defold.com

ok, it seems like I tested only with jetifier: false

You could also try to manually jettify the lib to make it Android X compatible. Download the .aar file, unpack it, grab the .jar file. Run the jettifier tool (as per instructions on the HelpShift page).

I also think you need to initialize the HelpShift SDK from Application.onCreate() which is problematic. This needs to be confirmed though.

I’ve just made a new project

and I have the same problem,
can anyone see where I went wrong ?

It seems like this is some issue with jetifier for that plugin, here is an instruction how to do it manually, but you’ll have to put jar file into a lib folder instead of using Gradle file for the android version:

./jetifier-standalone -i <source-library> -o <output-library>
2 Likes

Hi everyone!
finaly added extention, everything works, thanks for help!

5 Likes