Android Class resolved by unexpected DEX:

697 views
Skip to first unread message

Ne0

unread,
May 14, 2010, 7:12:52 AM5/14/10
to android-platform
Ok, i am trying to build an app using the open source tree and the
google maps jar from the SDK.

Following what the other apps do with the google login client i
created a LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES with the following
makefile

(frameworks/opt/com.google.android.maps/Android.mk)

LOCAL_PATH := $(my-dir)
include $(CLEAR_VARS)

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := googlemaps-
client:maps-7_r01.jar
include $(BUILD_MULTI_PREBUILT)

Then in my app package i have the following in my make file.

LOCAL_STATIC_JAVA_LIBRARIES := googlemaps-client

My manifest has

<uses-library android:name="com.google.android.maps" />

And i can build my application without any problems. Though when i
come to run it on my device i get the following error:

W/dalvikvm( 6747): Class resolved by unexpected DEX: Lcom/smmobileapps/
sviewer/SViewer;(0x44e4e998):0x11ebf8 ref [Lcom/google/android/maps/
MapActivity;] Lcom/google/android/maps/MapActivity;(0x44e4e998):
0x142528
W/dalvikvm( 6747): (Lcom/smmobileapps/sviewer/SViewer; had used a
different Lcom/google/android/maps/MapActivity; during pre-
verification)
W/dalvikvm( 6747): Unable to resolve superclass of Lcom/smmobileapps/
sviewer/SViewer; (149)
W/dalvikvm( 6747): Link of class 'Lcom/smmobileapps/sviewer/SViewer;'
failed
D/AndroidRuntime( 6747): Shutting down VM
W/dalvikvm( 6747): threadid=3: thread exiting with uncaught exception
(group=0x4001b178)
E/AndroidRuntime( 6747): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime( 6747): java.lang.NoClassDefFoundError:
com.smmobileapps.sviewer.SViewer
E/AndroidRuntime( 6747): at com.smmobileapps.SMMobileApps
$1.onItemClick(SMMobileApps.java:152)
E/AndroidRuntime( 6747): at
android.widget.AdapterView.performItemClick(AdapterView.java:284)
E/AndroidRuntime( 6747): at
android.widget.Gallery.onSingleTapUp(Gallery.java:864)
E/AndroidRuntime( 6747): at
android.view.GestureDetector.onTouchEvent(GestureDetector.java:506)
E/AndroidRuntime( 6747): at
android.widget.Gallery.onTouchEvent(Gallery.java:839)
E/AndroidRuntime( 6747): at
android.view.View.dispatchTouchEvent(View.java:3709)
E/AndroidRuntime( 6747): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:852)
E/AndroidRuntime( 6747): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
E/AndroidRuntime( 6747): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
E/AndroidRuntime( 6747): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
E/AndroidRuntime( 6747): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
E/AndroidRuntime( 6747): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
E/AndroidRuntime( 6747): at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:
1107)
E/AndroidRuntime( 6747): at
android.app.Activity.dispatchTouchEvent(Activity.java:2061)
E/AndroidRuntime( 6747): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
E/AndroidRuntime( 6747): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
E/AndroidRuntime( 6747): at
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 6747): at android.os.Looper.loop(Looper.java:
123)
E/AndroidRuntime( 6747): at
android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 6747): at
java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 6747): at
java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 6747): at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 6747): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 6747): at
dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 6747): Caused by: java.lang.IllegalAccessError:
Class ref in pre-verified class resolved to unexpected implementation
E/AndroidRuntime( 6747): at
dalvik.system.DexFile.defineClass(Native Method)
E/AndroidRuntime( 6747): at
dalvik.system.DexFile.loadClassBinaryName(DexFile.java:209)
E/AndroidRuntime( 6747): at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:203)
E/AndroidRuntime( 6747): at
java.lang.ClassLoader.loadClass(ClassLoader.java:573)
E/AndroidRuntime( 6747): at
java.lang.ClassLoader.loadClass(ClassLoader.java:532)
E/AndroidRuntime( 6747): ... 24 more


Can anyone help me figure out what i am doing wrong here?

Obviously i can just make this activity with the SDK, but my
application is designed to run on a custom build and the MapActivity
would then have downloaded and updated separately from the main
application package. Which can be annoying for the end user.

Ne0

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.

Jim Showalter

unread,
May 14, 2010, 5:18:20 PM5/14/10
to android-...@googlegroups.com
You have two copies of a class. When DEX sees the second copy, it throws that exception.

palash

unread,
Oct 19, 2012, 7:21:21 AM10/19/12
to android-...@googlegroups.com


Hello
Please help me ; I am in similar situation. Kindly let me know the resolution
if you have fixed it.

Thanks
Palash


Richard Le

unread,
Mar 5, 2014, 10:49:23 PM3/5/14
to android-...@googlegroups.com
Hello,

I tried to invoke method from a class from external apk file (without installing), The remote class used 3rd library as com.google.gson. When invoke remote method using reflection, I found the same error.
This is posted 3 years ago. But there is no asnwer to solve this error.
Have you ever solved it? Please share solution to me. I am really appreciated.


03-06 11:40:50.654: W/dalvikvm(26853): Class resolved by unexpected DEX: Lorg/vkedco/android/startedsumlooperservice/StartedSumLooperService;(0x40efce58):0x56f47000 ref [Lcom/google/gson/Gson;] Lcom/google/gson/Gson;(0x40eb0d78):0x56daa000
03-06 11:40:50.654: W/dalvikvm(26853): (Lorg/vkedco/android/startedsumlooperservice/StartedSumLooperService; had used a different Lcom/google/gson/Gson; during pre-verification)
Reply all
Reply to author
Forward
0 new messages