Android Question B4AGraphView - EdgeEffectCompat

PhilipK

Member
Licensed User
Longtime User
Hi B4A

I've been using the B4AGraphview library for a long time now. Suddenly, a problem and can't find the solution on the internet.

Compiling and running my app or the B4AGraphview example provided, generates the error:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/widget/EdgeEffectCompat;

With hours passing and no sight of solving it, I've done a complete re-installation of Java, Android SDK and B4A as per instructions. Now running jdk1.8.0_251, B4A v9.80 and checked the Android SDK in B4A and unfortunately, no success:

Error.jpg


Thanks in advance
 

DonManfred

Expert
Licensed User
Longtime User
Redownload AppCompat 4.0 ZIP.

It now includes a AndroidX Version too.

If that does not work i fear your SDK is incompatible.

To install a new SDK follow the installationinstructions carefully. 2 Zips to download and extract.

PD: You should posts errors as TEXT (right click to copy) instead of Screenshots!
 
Upvote 0

PhilipK

Member
Licensed User
Longtime User
Hi DonManfred

Thanks for that.
Just installed library AppCompat 4.0 and re-started B4A.

Still generates an error:

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (livedata) Create, isFirst = true **
xData lenght: 100 yData lenght 100
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/widget/EdgeEffectCompat;
at com.jjoe64.graphview.Viewport.<init>(Viewport.java:438)
at com.jjoe64.graphview.GraphView.init(GraphView.java:207)
at com.jjoe64.graphview.GraphView.<init>(GraphView.java:169)
at com.genesis.graphview.graphview.Initialize(graphview.java:46)
at com.genesis.graphview.livedata._activity_create(livedata.java:400)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at com.genesis.graphview.livedata.afterFirstLayout(livedata.java:104)
at com.genesis.graphview.livedata.access$000(livedata.java:17)
at com.genesis.graphview.livedata$WaitForLayout.run(livedata.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:280)
at android.app.ActivityThread.main(ActivityThread.java:6706)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.widget.EdgeEffectCompat" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.genesis.graphview-sM0Ytgo8B-CVmCxQ8aru0A==/base.apk"],nativeLibraryDirectories=[/data/app/com.genesis.graphview-sM0Ytgo8B-CVmCxQ8aru0A==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 21 more
** Activity (livedata) Resume **
** Activity (livedata) Pause, UserClosed = true **

Does the #region Project attributes look right?:
#ApplicationLabel: B4AGraphView Example
#VersionCode: 1
#VersionName: 1.0.0
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#Extends: android.support.v7.app.AppCompatActivity
'#AdditionalRes: $AdditionalLibs$\resource\b4a_appcompat, de.amberhome.objects.appcompat
'#AdditionalRes: $AndroidSDK$\extras\android\support\v7\appcompat\res, android.support.v7.appcompat

The manifest:

AddManifestText(
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@style/Theme.AppCompat")
SetActivityAttribute(SimpleSeries, android:screenOrientation, "landscape")
 
Upvote 0

PhilipK

Member
Licensed User
Longtime User
Arrgh, it hasn't worked:

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (livedata) Create, isFirst = true **
xData lenght: 100 yData lenght 100
graphviewInitialize (java line: 46)
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/widget/EdgeEffectCompat;
at com.jjoe64.graphview.Viewport.<init>(Viewport.java:438)
at com.jjoe64.graphview.GraphView.init(GraphView.java:207)
at com.jjoe64.graphview.GraphView.<init>(GraphView.java:169)
at com.genesis.graphview.graphview.Initialize(graphview.java:46)
at com.genesis.graphview.livedata._activity_create(livedata.java:386)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at com.genesis.graphview.livedata.afterFirstLayout(livedata.java:104)
at com.genesis.graphview.livedata.access$000(livedata.java:17)
at com.genesis.graphview.livedata$WaitForLayout.run(livedata.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:280)
at android.app.ActivityThread.main(ActivityThread.java:6706)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.widget.EdgeEffectCompat" on path: DexPathList[[zip file "/data/app/com.genesis.graphview-XdINLQDH6h_lsHOS6Icc8g==/base.apk"],nativeLibraryDirectories=[/data/app/com.genesis.graphview-XdINLQDH6h_lsHOS6Icc8g==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 17 more
graphviewInitialize (java line: 46)
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/widget/EdgeEffectCompat;
at com.jjoe64.graphview.Viewport.<init>(Viewport.java:438)
at com.jjoe64.graphview.GraphView.init(GraphView.java:207)
at com.jjoe64.graphview.GraphView.<init>(GraphView.java:169)
at com.genesis.graphview.graphview.Initialize(graphview.java:46)
at com.genesis.graphview.livedata._activity_create(livedata.java:386)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at com.genesis.graphview.livedata.afterFirstLayout(livedata.java:104)
at com.genesis.graphview.livedata.access$000(livedata.java:17)
at com.genesis.graphview.livedata$WaitForLayout.run(livedata.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:280)
at android.app.ActivityThread.main(ActivityThread.java:6706)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.widget.EdgeEffectCompat" on path: DexPathList[[zip file "/data/app/com.genesis.graphview-XdINLQDH6h_lsHOS6Icc8g==/base.apk"],nativeLibraryDirectories=[/data/app/com.genesis.graphview-XdINLQDH6h_lsHOS6Icc8g==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 17 more

The app starts and the crashes on selecting 'Live data'
 
Upvote 0

PhilipK

Member
Licensed User
Longtime User
Just noticed the SDK manager in B4A looks in a folder ..AppData/Local/Android/SDK . I have been updating C:/Android/tools. Is this the issue? I should be updating the AppData path?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Just noticed the SDK manager in B4A looks in a folder ..AppData/Local/Android/SDK . I have been updating C:/Android/tools. Is this the issue? I should be updating the AppData path?
If you installed a new sdk you need to adapt the path in the ide to this new sdk. Sure.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Download the SDK with the link provided here.


  • You need to download two components, both of them do not require installation.
  • Download Android SDK Command line tools
    Make sure to read and agree to the SDK license. Click on the Windows command line tools to see the license.
    Android Studio is not needed and will not be affected by the command line tools (which are always required).
  • Unzip it in a folder such as C:\Android
    explorer_e39aklwgDQ.png
  • Download the required resources.
  • Unzip in the same folder. It should look like this:
    explorer_hfrxvrNO6q.png

Any other download will not work.
 
Upvote 0

PhilipK

Member
Licensed User
Longtime User
I've seen that there are AppCompat jar and xml in the additional libraries folder which I have removed. I extracted the AppCompat4 lib in the C:/anywhere../B4A/library folder and it still fails.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I ran your example.

It does not work here too. I guess the problem is inside the Graphview jar which, it seems, it not AndroidX compatible.

I then jetified all libraries. and tried again.
C:/anywhere../B4A/library
This is the WRONG folder! It must be placed into the additional library folder. NEVER in the internal

Run the jetifier tool and try again.

After i jetified Graphview library your example does work
 
Upvote 0

PhilipK

Member
Licensed User
Longtime User
Ok, I put the AppCompats in the additional library folder , removed them from the internal folder, used the Jetify tool which opened a window saying the AppCompat will be jetified. Run it again and failed. Can't see how you Jetify the Graphview?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Can't see how you Jetify the Graphview?
Graphview must be inside the additional lib folder too! The jetifier tool should have listed it too. At least this worked for me

Again: Download appcompat 4.0 and use the files in this zip. NO NEED to jetifier AppCpmpat
 
Upvote 0
Top