1

I have updated my project to work with latest codename api 3.3. In my android app i use scancode to scan QR codes. It have been working great. Now when i try the new build, my app is crashing immediately. After some digging i found out that it was the scancode api import causing it. After disabling all code related to the scancode api, my app was working again.

My old app build, built on previous codenameone i believe it's 3.1, is working fine.

I have tested the new external api as recommended, and i have tested the built in api, with the same result.

Im testing on Android 5.0 I have built my app with and without java support 8. In the simulator i have no crach.

From google crach report i have the following

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
    at com.google.android.gms.measurement.internal.i.<clinit>(Unknown Source)
    at com.google.android.gms.measurement.internal.ac.h(Unknown Source)
    at com.google.android.gms.measurement.internal.y.<init>(Unknown Source)
    at com.google.android.gms.measurement.internal.ac.a(Unknown Source)
    at com.google.android.gms.measurement.internal.y.a(Unknown Source)
    at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:1716)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:1685)
    at android.app.ActivityThread.installProvider(ActivityThread.java:5559)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:5154)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5094)
    at android.app.ActivityThread.access$1600(ActivityThread.java:177)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1509)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:5942)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap" on path: DexPathList[[zip file "/data/app/se.epu.mobiprint-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 20 more
    Suppressed: java.lang.ClassNotFoundException: android.support.v4.util.ArrayMap
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 21 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

I belive its related to the following in the scancode api

package com.codename1.ext.codescan;

import android.app.Activity;
import android.content.Intent;
import com.codename1.impl.android.AndroidNativeUtil;
import com.codename1.impl.android.CodenameOneActivity;
import com.codename1.impl.android.IntentIntegrator;
import com.codename1.impl.android.IntentResultListener;
import com.codename1.ui.Display;
import java.util.Arrays;
import java.util.Collection;

import java.util.Arrays;

import java.util.Collection;

There are some threads regarding this issue (missing class android.support.v4.util.ArrayMap), but i believe its a CN1 issue?

ClassNotFoundException after ADT update

Eclipse giving error, missing R.java file after recent update

I hope this is somthing CN1 can fix?

Community
  • 1
  • 1
Mattias
  • 11
  • 2

2 Answers2

1

Codescan has recently been deprecated from Codename one core. Your issue may be due to this.

As stated in the blog post, to use Codescan with Codenameone 3.3 and later, you will have to download the cn1lib cn1-codescan.cn1lib and place it in your project lib folder.

I will encourage you to always follow the blog for recent changes and new features.

You can read more about the deprecation in this blog.

Diamond
  • 7,428
  • 22
  • 37
  • 1
    I would suggest trying to disable the gradle build for now. I think its related to the google play services change we made. Try `android.gradle=false` in the build hints. – Shai Almog Feb 05 '16 at 04:35
  • As i have written i have using the external lib/api. I have also tried the internal deprecated one with the same reslut. Shai answers help using android.gradle=false – Mattias Feb 05 '16 at 06:55
0

Thanks Shai

It work when using build hint android.gradle=false

Mattias
  • 11
  • 2