Conflict dropbox sync api with another native library in Android - android

My app use tess-two (https://github.com/rmtheis/tess-two) library which uses native api. When I use separate tess-two or dropbox sync api, there is nothing happen. But my app need to use both libraries, and when I add two libraries at the same time, I got the exception with dropbox sync api like this:
11-20 16:18:30.440: E/AndroidRuntime(7672): FATAL EXCEPTION: main
11-20 16:18:30.440: E/AndroidRuntime(7672): java.lang.ExceptionInInitializerError
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.CoreAccountManager.initNativeLib(CoreAccountManager.java:155)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.CoreAccountManager.<init>(CoreAccountManager.java:126)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:149)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:115)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.appiphany.roboscanner.utils.Config.getDropboxAccountManager(Config.java:19)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.appiphany.roboscanner.DocumentListFragment.onAttach(DocumentListFragment.java:110)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:883)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.appiphany.roboscanner.BaseActivity.onStart(BaseActivity.java:28)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1167)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.Activity.performStart(Activity.java:5216)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2073)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.ActivityThread.access$600(ActivityThread.java:140)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.os.Looper.loop(Looper.java:137)
11-20 16:18:30.440: E/AndroidRuntime(7672): at android.app.ActivityThread.main(ActivityThread.java:4898)
11-20 16:18:30.440: E/AndroidRuntime(7672): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 16:18:30.440: E/AndroidRuntime(7672): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
11-20 16:18:30.440: E/AndroidRuntime(7672): at dalvik.system.NativeStart.main(Native Method)
11-20 16:18:30.440: E/AndroidRuntime(7672): Caused by: java.lang.ExceptionInInitializerError
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.NativeLib.<init>(NativeLib.java:33)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.NativeLib.<clinit>(NativeLib.java:11)
11-20 16:18:30.440: E/AndroidRuntime(7672): ... 26 more
11-20 16:18:30.440: E/AndroidRuntime(7672): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load DropboxSync: findLibrary returned null
11-20 16:18:30.440: E/AndroidRuntime(7672): at java.lang.Runtime.loadLibrary(Runtime.java:365)
11-20 16:18:30.440: E/AndroidRuntime(7672): at java.lang.System.loadLibrary(System.java:535)
11-20 16:18:30.440: E/AndroidRuntime(7672): at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:446)
I'm sure that I have copied all .so and jar library files of dropbox sync api into my libs folder. And I also refer this link Error in dropboxSync: findlibrary returned null, but it doesn't work. Is there any idea?
Update: my Android.mk of tess-two look like this ( I don't change anything from github source because I think two libraries don't reference each other):
LOCAL_PATH := $(call my-dir)
TESSERACT_PATH := $(LOCAL_PATH)/com_googlecode_tesseract_android/src
LEPTONICA_PATH := $(LOCAL_PATH)/com_googlecode_leptonica_android/src
# Just build the Android.mk files in the subdirs
include $(call all-subdir-makefiles)

Problem is solved by copying libDropboxSync.so from armeabi to armeabi-v7a folder but I don't know how it can work. More detail in my own question from dropbox 4rum

Related

Ionic Framework start error on Android

I have a project with Ionic working fine in iOS (emulator and device), web and with a problem in Android.
I have used to create the project:
ionic platform add android
I open the project with Eclipse, everything is Ok, no errors, and CordovaLib is loading fine.
When I try to deploy in my device, I have this error:
11-20 15:22:56.350: E/AndroidRuntime(10312): FATAL EXCEPTION: main
11-20 15:22:56.350: E/AndroidRuntime(10312): Process: com.ionicframework.congressapp251163, PID: 10312
11-20 15:22:56.350: E/AndroidRuntime(10312): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ionicframework.congressapp251163/com.ionicframework.congressapp251163.CordovaApp}: java.lang.NullPointerException
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2447)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2507)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.access$900(ActivityThread.java:172)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.os.Handler.dispatchMessage(Handler.java:102)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.os.Looper.loop(Looper.java:146)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.main(ActivityThread.java:5692)
11-20 15:22:56.350: E/AndroidRuntime(10312): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 15:22:56.350: E/AndroidRuntime(10312): at java.lang.reflect.Method.invoke(Method.java:515)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
11-20 15:22:56.350: E/AndroidRuntime(10312): at dalvik.system.NativeStart.main(Native Method)
11-20 15:22:56.350: E/AndroidRuntime(10312): Caused by: java.lang.NullPointerException
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:191)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:114)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.init(PluginManager.java:92)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:383)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:368)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrl(CordovaWebView.java:344)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:389)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.ionicframework.congressapp251163.CordovaApp.onCreate(CordovaApp.java:33)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.Activity.performCreate(Activity.java:5541)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)
11-20 15:22:56.350: E/AndroidRuntime(10312): ... 11 more
EDIT:
The plugins have not been copying to the Android Project :(
Help please ;) Thanks!!
I had the same problem,but solved using this way.After creating the project first I build the project using the command ionic build android, then import it.if its not working try this
1.Remove the platform using ionic platform remove android
2.Add the platform again,and run.

loading activities from external dex/jar files

I have a lib.apk that is sent by server and received by my application and then saved on sdcard.now I want run activities of inside my library but when I try do it, it gives me error do you define activity in manifest. I added activity tag to manifest of my lib but it still didn't work. Can anyone give any idea?
manifest file of my lib
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lib"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.lib.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
logcat error
11-20 05:16:49.918: W/System.err(6721): java.lang.reflect.InvocationTargetException
11-20 05:16:49.938: W/System.err(6721): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 05:16:49.948: W/System.err(6721): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 05:16:49.948: W/System.err(6721): at com.example.myapp2.MainActivity.onCreate(MainActivity.java:29)
11-20 05:16:49.948: W/System.err(6721): at android.app.Activity.performCreate(Activity.java:5104)
11-20 05:16:49.948: W/System.err(6721): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
11-20 05:16:49.948: W/System.err(6721): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
11-20 05:16:49.958: W/System.err(6721): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
11-20 05:16:49.958: W/System.err(6721): at android.app.ActivityThread.access$600(ActivityThread.java:141)
11-20 05:16:49.958: W/System.err(6721): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
11-20 05:16:49.958: W/System.err(6721): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 05:16:49.969: W/System.err(6721): at android.os.Looper.loop(Looper.java:137)
11-20 05:16:49.969: W/System.err(6721): at android.app.ActivityThread.main(ActivityThread.java:5041)
11-20 05:16:49.969: W/System.err(6721): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 05:16:49.969: W/System.err(6721): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 05:16:49.969: W/System.err(6721): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
11-20 05:16:49.978: W/System.err(6721): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
11-20 05:16:49.978: W/System.err(6721): at dalvik.system.NativeStart.main(Native Method)
11-20 05:16:49.978: W/System.err(6721): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.myapp2/com.example.lib.MainActivity}; have you declared this activity in your AndroidManifest.xml?
11-20 05:16:49.988: W/System.err(6721): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
11-20 05:16:50.000: W/System.err(6721): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
11-20 05:16:50.008: W/System.err(6721): at android.app.Activity.startActivityForResult(Activity.java:3370)
11-20 05:16:50.008: W/System.err(6721): at android.app.Activity.startActivityForResult(Activity.java:3331)
11-20 05:16:50.008: W/System.err(6721): at android.app.Activity.startActivity(Activity.java:3566)
11-20 05:16:50.019: W/System.err(6721): at android.app.Activity.startActivity(Activity.java:3534)
11-20 05:16:50.028: W/System.err(6721): at com.example.lib.Main.onCreate(Main.java:32)
You cannot run activties that have not been installed on the phone. Just having an APK on the SD-card is not enough. This APK will need to be installed on the device.

Update old android project

I am following this tutorial and I can make it work just fine, but when I try to update the UI to fit the new Holo.Light in android 4.2 the app crashes at launch, and I don't know why.
I have been searching for a way to update the UI but I could not get it to work.
I wonder if anybody could help me? tell me how? Give me a link that you know would work?
or even do it yourself?
i get this error log:
11-20 09:50:39.523: I/dalvikvm(1460): threadid=3: reacting to signal 3
11-20 09:50:39.682: I/dalvikvm(1460): Wrote stack traces to '/data/anr/traces.txt'
11-20 09:50:39.892: I/dalvikvm(1460): threadid=3: reacting to signal 3
11-20 09:50:40.003: I/dalvikvm(1460): Wrote stack traces to '/data/anr/traces.txt'
11-20 09:50:40.102: D/AndroidRuntime(1460): Shutting down VM
11-20 09:50:40.102: W/dalvikvm(1460): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
11-20 09:50:40.132: E/AndroidRuntime(1460): FATAL EXCEPTION: main
11-20 09:50:40.132: E/AndroidRuntime(1460): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidhive.jsonparsing/com.androidhive.jsonparsing.AndroidJSONParsingActivity}: android.os.NetworkOnMainThreadException
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.os.Looper.loop(Looper.java:137)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread.main(ActivityThread.java:4424)
11-20 09:50:40.132: E/AndroidRuntime(1460): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 09:50:40.132: E/AndroidRuntime(1460): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 09:50:40.132: E/AndroidRuntime(1460): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-20 09:50:40.132: E/AndroidRuntime(1460): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-20 09:50:40.132: E/AndroidRuntime(1460): at dalvik.system.NativeStart.main(Native Method)
11-20 09:50:40.132: E/AndroidRuntime(1460): Caused by: android.os.NetworkOnMainThreadException
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
11-20 09:50:40.132: E/AndroidRuntime(1460): at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
11-20 09:50:40.132: E/AndroidRuntime(1460): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
11-20 09:50:40.132: E/AndroidRuntime(1460): at java.net.InetAddress.getAllByName(InetAddress.java:220)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
11-20 09:50:40.132: E/AndroidRuntime(1460): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
11-20 09:50:40.132: E/AndroidRuntime(1460): at com.androidhive.jsonparsing.JSONParser.getJSONFromUrl(JSONParser.java:38)
11-20 09:50:40.132: E/AndroidRuntime(1460): at com.androidhive.jsonparsing.AndroidJSONParsingActivity.onCreate(AndroidJSONParsingActivity.java:53)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.Activity.performCreate(Activity.java:4465)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-20 09:50:40.132: E/AndroidRuntime(1460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
11-20 09:50:40.132: E/AndroidRuntime(1460): ... 11 more
11-20 09:50:40.392: I/dalvikvm(1460): threadid=3: reacting to signal 3
11-20 09:50:40.412: I/dalvikvm(1460): Wrote stack traces to '/data/anr/traces.txt'
11-20 09:50:40.791: I/dalvikvm(1460): threadid=3: reacting to signal 3
11-20 09:50:40.962: I/dalvikvm(1460): Wrote stack traces to '/data/anr/traces.txt'
You are making a network call on the main thread. This is not allowed on Android 4.2, and is a really bad idea on earlier versions which do permit this. I have blogged about various mechanisms for moving network and other heavy calls off the main thread at http://blog.stylingandroid.com/archives/833.
Without seeing your code, I cannot begin to suggest which approach is the right one for you to use, but hopefully the information in my articles will help you in deciding upon the correct approach.
There are two Solution of this Problem.
1) Don't write network call in Main UIThread, Use Async Task for that.
2) Write below code into your MainActivity file after setContentView(R.layout.activity_main);
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
And below import statement into your java file.
import android.os.StrictMode;
and see below link for more information.
Twitter connect error

How can my Android app open a port for listening?

I want my Android app to behave as a client and listen on a particular port. None of the code I've tried works. I tried this tutorial to create a small chat app. The server side works fine, but the app crashes on my device. I have both my phone and server comp on VPN.
logcat text returned:
11-20 12:39:12.789: W/dalvikvm(12045): threadid=1: thread exiting with uncaught exception (group=0x4017c560)
11-20 12:39:12.799: E/AndroidRuntime(12045): FATAL EXCEPTION: main
11-20 12:39:12.799: E/AndroidRuntime(12045): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android_port/com.example.android_port.MainActivity}: java.lang.ClassNotFoundException: com.example.android_port.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.android_port-1.apk]
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.os.Looper.loop(Looper.java:130)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread.main(ActivityThread.java:3687)
11-20 12:39:12.799: E/AndroidRuntime(12045): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 12:39:12.799: E/AndroidRuntime(12045): at java.lang.reflect.Method.invoke(Method.java:507)
11-20 12:39:12.799: E/AndroidRuntime(12045): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
11-20 12:39:12.799: E/AndroidRuntime(12045): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
11-20 12:39:12.799: E/AndroidRuntime(12045): at dalvik.system.NativeStart.main(Native Method)
11-20 12:39:12.799: E/AndroidRuntime(12045): Caused by: java.lang.ClassNotFoundException: com.example.android_port.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.android_port-1.apk]
11-20 12:39:12.799: E/AndroidRuntime(12045): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
11-20 12:39:12.799: E/AndroidRuntime(12045): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
11-20 12:39:12.799: E/AndroidRuntime(12045): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-20 12:39:12.799: E/AndroidRuntime(12045): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
11-20 12:39:12.799: E/AndroidRuntime(12045): ... 11 more

VerifyError, class being rejected, VFY: register1 v6 type 12, wanted 11

I'm currently working on a Wrapper for Android, Which wraps an android
apk with some DRM related stuff.. which are by the way Android
activities..
The activities i had created worked perfectly when I tested them in an
Emulator as well as on a Device.
I tried integrating it with an Application from our org's apps
store... Steps below
Extracted the apk with apktool
* Extracted class files with dex2jar
* added the class files to an Eclipse android project as classes
folder
* Added the activity def from the original app manifest to my manifest
* Compiled and Launched the app from eclipse*
Note : The activities I had created are working very fine.. They load
complete their work and try to launch the game application i was using
to Test Integration.
here's when I come across the VerifyError
11-20 22:44:07.670: W/System.err(281): at
***java.lang.Thread.run(Thread.java:1096)
11-20 22:44:08.050: W/dalvikvm(281): VFY: register1 v0 type 12, wanted
10
11-20 22:44:08.050: W/dalvikvm(281): VFY: register1 v1 type 12, wanted
10
11-20 22:44:08.050: W/dalvikvm(281): VFY: rejecting opcode 0x71 at
0x0016
11-20 22:44:08.050: W/dalvikvm(281): VFY: rejected Lao;.a (Ldh;)I
11-20 22:44:08.050: W/dalvikvm(281): Verifier rejected class Lao;***
11-20 22:44:08.060: D/AndroidRuntime(281): Shutting down VM
11-20 22:44:08.060: W/dalvikvm(281): threadid=1: thread exiting with
uncaught exception (group=0x4001d800)
11-20 22:44:08.170: E/AndroidRuntime(281): FATAL EXCEPTION: main
11-20 22:44:08.170: E/AndroidRuntime(281): java.lang.VerifyError: ao
11-20 22:44:08.170: E/AndroidRuntime(281): at
ca.jamdat.flight.trivialpursuit_hvga_eu.FlAndroidApp.onCreate(Unknown
Source)
11-20 22:44:08.170: E/AndroidRuntime(281): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
11-20 22:44:08.170: E/AndroidRuntime(281): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2627)
11-20 22:44:08.170: E/AndroidRuntime(281): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
11-20 22:44:08.170: E/AndroidRuntime(281): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-20 22:44:08.170: E/AndroidRuntime(281): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-20 22:44:08.170: E/AndroidRuntime(281): at
android.os.Handler.dispatchMessage(Handler.java:99)
11-20 22:44:08.170: E/AndroidRuntime(281): at
android.os.Looper.loop(Looper.java:123)
11-20 22:44:08.170: E/AndroidRuntime(281): at
android.app.ActivityThread.main(ActivityThread.java:4627)
11-20 22:44:08.170: E/AndroidRuntime(281): at
java.lang.reflect.Method.invokeNative(Native Method)
11-20 22:44:08.170: E/AndroidRuntime(281): at
java.lang.reflect.Method.invoke(Method.java:521)
11-20 22:44:08.170: E/AndroidRuntime(281): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-20 22:44:08.170: E/AndroidRuntime(281): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-20 22:44:08.170: E/AndroidRuntime(281): at
dalvik.system.NativeStart.main(Native Method)
And now I have worked around the problem..
The problem probably is dex2jar tool i used to extract the .class files from the apk (classes probably being corrupt).
I created smali files of my implementation and pasted them into smali folder of the actual application extracted using the apktool and loaded the classes using reflecion rather than directly importing them into my compiled bytecode.
Offfffffff resolved... :)

Categories

Resources