Desire2Learn Connection via Android - android

I am trying to connect to d2l via android. (I normally use C# but have decided to try an android application).
I have tried using the java client library compiling it and putting the .jar file into my libs folder with in the android project but the app crashes whenever I try to create an authenticated URI.
Anyone have any ideas? tips? I've searched for an example but haven't found one yet.
Thanks!
There is nothing being output to the console but this is what I get in the Logs hopefully this is what you're looking for:
04-16 17:05:39.690: W/dalvikvm(2118): VFY: unable to resolve static method 3861: Lorg/apache/commons/codec/binary/Base64;.encodeBase64 ([BZZ)[B
04-16 17:05:39.690: D/dalvikvm(2118): VFY: replacing opcode 0x71 at 0x0010
04-16 17:05:39.730: W/dalvikvm(2118): threadid=11: thread exiting with uncaught exception (group=0x418c6700)
04-16 17:05:39.740: E/AndroidRuntime(2118): FATAL EXCEPTION: Thread-183
04-16 17:05:39.740: E/AndroidRuntime(2118): java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64
04-16 17:05:39.740: E/AndroidRuntime(2118): at com.d2lvalence.idkeyauth.implementation.D2LSigner.getBase64HashString(D2LSigner.java:40)
04-16 17:05:39.740: E/AndroidRuntime(2118): at com.d2lvalence.idkeyauth.implementation.D2LUserContext.buildAuthenticatedUriQueryString(D2LUserContext.java:129)
04-16 17:05:39.740: E/AndroidRuntime(2118): at com.d2lvalence.idkeyauth.implementation.D2LUserContext.getQueryString(D2LUserContext.java:163)
04-16 17:05:39.740: E/AndroidRuntime(2118): at com.d2lvalence.idkeyauth.implementation.D2LUserContext.createAuthenticatedUri(D2LUserContext.java:93)
04-16 17:05:39.740: E/AndroidRuntime(2118): at com.example.d2lprofileupdate.D2LRest.GetName(D2LRest.java:100)
04-16 17:05:39.740: E/AndroidRuntime(2118): at com.example.d2lprofileupdate.MainActivity$1.run(MainActivity.java:32)
04-16 17:05:39.740: E/AndroidRuntime(2118): at java.lang.Thread.run(Thread.java:841)
04-16 17:05:39.820: D/libEGL(2118): loaded /system/lib/egl/libEGL_tegra.so
04-16 17:05:39.840: D/libEGL(2118): loaded /system/lib/egl/libGLESv1_CM_tegra.so
04-16 17:05:39.870: D/libEGL(2118): loaded /system/lib/egl/libGLESv2_tegra.so
04-16 17:05:39.900: D/OpenGLRenderer(2118): Enabling debug mode 0

Related

OutOfMemoryError problems - android

my app (memory game) is using various images. In my /drawable/ folder are about ~50 .png images with 252x252 size. My app has some levels, for example 4x3, 4x6 etc. After 3-4 games (for example, I started from 2x2 to 4x6) - my app is crashing (Unfortunately, your app has stopped). In LogCat I have these errors:
04-16 23:05:35.382: E/AndroidRuntime(13622): FATAL EXCEPTION: main
04-16 23:05:35.382: E/AndroidRuntime(13622): java.lang.OutOfMemoryError
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.graphics.Bitmap.nativeCreate(Native Method)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:530)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:505)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:357)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:777)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.content.res.Resources.loadDrawable(Resources.java:1940)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.content.res.Resources.getDrawable(Resources.java:669)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.view.View.setBackgroundResource(View.java:11861)
04-16 23:05:35.382: E/AndroidRuntime(13622): at com.example.testlogo.MainActivity.onCreate(MainActivity.java:145)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.app.Activity.performCreate(Activity.java:4465)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.app.ActivityThread.access$600(ActivityThread.java:127)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.os.Handler.dispatchMessage(Handler.java:99)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.os.Looper.loop(Looper.java:137)
04-16 23:05:35.382: E/AndroidRuntime(13622): at android.app.ActivityThread.main(ActivityThread.java:4448)
04-16 23:05:35.382: E/AndroidRuntime(13622): at java.lang.reflect.Method.invokeNative(Native Method)
04-16 23:05:35.382: E/AndroidRuntime(13622): at java.lang.reflect.Method.invoke(Method.java:511)
04-16 23:05:35.382: E/AndroidRuntime(13622): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
04-16 23:05:35.382: E/AndroidRuntime(13622): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
04-16 23:05:35.382: E/AndroidRuntime(13622): at dalvik.system.NativeStart.main(Native Method)
As I said, I am using images from /drawable/ folder. To make for example 4x3 level, I am using GridLayout and ImageButtons. I have a method, which randomizes ImageButton's place and then I am putting the image to the ImageButton, like this:
button1.setImageResource(R.drawable.logo);
For resize my ImageButton I am using:
Display display = getWindowManager().getDefaultDisplay();
int screenwidth = display.getWidth();
int screenheight = display.getHeight();
button.setMaxHeight(screenwidth/3);
button.setMaxWidth(screenwidth/3);
So I do not really know, how to manage with my problem. Maybe should I use Bitmap instead of ImageResource?
Note:
1)Every level have own class, they are very similar to each other.
2)Every level class have 24 images. If the level is 4x3 I will get first random 6 pics.
3)Every activity are using finish(); method if the activity is closed/onBackPressed.
int[] img ={R.drawable.cherry90,R.drawable.apple90,R.drawable.applered90,R.drawable.apricot90,R.drawable.banana90,R.drawable.blueberry90,
R.drawable.coconut90,R.drawable.gooseberry90,R.drawable.grape90,R.drawable.grapefruit90,R.drawable.kiwi90,R.drawable.lemon90,
R.drawable.lime90,R.drawable.mandarin90,R.drawable.mango90,R.drawable.melon,R.drawable.papaya90,R.drawable.peach90,
R.drawable.pears90,R.drawable.pineapple,R.drawable.plums90,R.drawable.pomegranate90,R.drawable.raspberry90,R.drawable.strawberry90};
I hope you will understand what I wanted to say. I were searching an answer to this problem, but did not find.
Basically it an error that indicates you have used excess of your ram memory allocations, there is nothing wrong in your code it just needs to be optimized.
Here are a few ways to do this:
Reduce the resolution of the images, you can still stretch them to the same size, but they wont show in as much detail.
Delete or re-use image variable space.
If you show the same image multiple times on the screen, like with most tiled maps. only create one variable where the image is stored.
Remember variables mean ram.

OpenCV on Android without OpenCV Manager

I know that my question was asked before.
But no solution is working for me.
For now I tried this solutions:
Solution 1
Solution 2
Solution 3
Solution 4
But no one of them worked for me.
My application project include a JNI part so I added all the mentioned line from THIS tutorial to the Android.mk file,
I comment this line :
if(!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback));
And added:
static {
if (!OpenCVLoader.initDebug()) {
// Handle initialization error
}
}
After public void onResume()
My application gets stuck and crushed when the OpenCV started.
This is the LogCat output:
04-16 10:00:25.020: W/System.err(14797): java.io.FileNotFoundException: /storage/emulated/0/DCIM/Frames/20140416_100025.mp4: open failed: ENOENT (No such file or directory)
04-16 10:00:25.020: W/System.err(14797): at libcore.io.IoBridge.open(IoBridge.java:409)
04-16 10:00:25.020: W/System.err(14797): at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
04-16 10:00:25.020: W/System.err(14797): at java.io.FileOutputStream.<init>(FileOutputStream.java:128)
04-16 10:00:25.020: W/System.err(14797): at java.io.FileOutputStream.<init>(FileOutputStream.java:117)
04-16 10:00:25.025: W/System.err(14797): at android.media.MediaRecorder.prepare(MediaRecorder.java:776)
04-16 10:00:25.025: W/System.err(14797): at com.example.homedevice.SampleTestingAct.prepareRecorder(SampleTestingAct.java:371)
04-16 10:00:25.025: W/System.err(14797): at com.example.homedevice.SampleTestingAct.StartTest(SampleTestingAct.java:443)
04-16 10:00:25.025: W/System.err(14797): at com.example.homedevice.SampleTestingAct.access$0(SampleTestingAct.java:420)
04-16 10:00:25.025: W/System.err(14797): at com.example.homedevice.SampleTestingAct$2$1.run(SampleTestingAct.java:2037)
04-16 10:00:25.025: W/System.err(14797): at java.util.Timer$TimerImpl.run(Timer.java:284)
04-16 10:00:25.025: W/System.err(14797): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
04-16 10:00:25.025: W/System.err(14797): at libcore.io.Posix.open(Native Method)
04-16 10:00:25.030: W/System.err(14797): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
04-16 10:00:25.030: W/System.err(14797): at libcore.io.IoBridge.open(IoBridge.java:393)
04-16 10:00:25.030: W/System.err(14797): ... 9 more
04-16 10:00:25.260: E/MediaRecorder(14797): start called in an invalid state: 4
04-16 10:00:25.260: W/dalvikvm(14797): threadid=16: thread exiting with uncaught exception (group=0x41c44700)
04-16 10:00:25.260: E/AndroidRuntime(14797): FATAL EXCEPTION: Timer-2
04-16 10:00:25.260: E/AndroidRuntime(14797): java.lang.IllegalStateException
04-16 10:00:25.260: E/AndroidRuntime(14797): at android.media.MediaRecorder.start(Native Method)
04-16 10:00:25.260: E/AndroidRuntime(14797): at com.example.homedevice.SampleTestingAct.StartTest(SampleTestingAct.java:445)
04-16 10:00:25.260: E/AndroidRuntime(14797): at com.example.homedevice.SampleTestingAct.access$0(SampleTestingAct.java:420)
04-16 10:00:25.260: E/AndroidRuntime(14797): at com.example.homedevice.SampleTestingAct$2$1.run(SampleTestingAct.java:2037)
04-16 10:00:25.260: E/AndroidRuntime(14797): at java.util.Timer$TimerImpl.run(Timer.java:284)
04-16 10:00:32.555: I/Choreographer(14797): Skipped 436 frames! The application may be doing too much work on its main thread.
04-16 10:00:32.715: E/ViewSystem(14797): ViewRootImpl #2 Surface is not valid.
04-16 10:00:32.725: E/MediaRecorder(14797): stop called in an invalid state: 4
04-16 10:00:32.725: D/AndroidRuntime(14797): Shutting down VM
04-16 10:00:32.725: W/dalvikvm(14797): threadid=1: thread exiting with uncaught exception (group=0x41c44700)
04-16 10:00:32.730: I/Process(14797): Sending signal. PID: 14797 SIG: 9
04-16 10:00:33.060: D/dalvikvm(15019): GC_FOR_ALLOC freed 56K, 12% free 9605K/10840K, paused 13ms, total 14ms
04-16 10:00:33.060: I/dalvikvm-heap(15019): Grow heap (frag case) to 11.604MB for 1127536-byte allocation
04-16 10:00:33.080: D/dalvikvm(15019): GC_FOR_ALLOC freed <1K, 11% free 10706K/11944K, paused 20ms, total 20ms
04-16 10:00:33.115: D/dalvikvm(15019): GC_FOR_ALLOC freed <1K, 10% free 11593K/12832K, paused 11ms, total 11ms
04-16 10:00:33.200: D/libEGL(15019): loaded /system/lib/egl/libEGL_mali.so
04-16 10:00:33.200: D/libEGL(15019): loaded /system/lib/egl/libGLESv1_CM_mali.so
04-16 10:00:33.205: D/libEGL(15019): loaded /system/lib/egl/libGLESv2_mali.so
04-16 10:00:33.210: E/(15019): Device driver API match
04-16 10:00:33.210: E/(15019): Device driver API version: 23
04-16 10:00:33.210: E/(15019): User space API version: 23
04-16 10:00:33.210: E/(15019): mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct 9 21:05:57 KST 2013
04-16 10:00:33.265: D/OpenGLRenderer(15019): Enabling debug mode 0
Is it possible to work with OpenCV without the OpenCV manager(maybe include him in my app?)
Hope that someone can help here.
Thanks!
sure you can do that. You just need to have the specific OpenCV libraries packed in your APK. Have a look at my reply here.

Zxing CaptureActivity - crashing when launching activity

I am trying to integrate the QR reading capabilities of Zxing into a stand-alone app, and have been using this very helpful guide http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/ along with these pointers Integrating the ZXing library directly into my Android application but after having built the library, and followed all steps to launch this activity on a button press, it still does not work. The app launches, but upon pressing the button, it crashes.
activity_main.html
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="buttPress"
android:text="#string/button_send"
android:textColor="#FFFFFF"
/>
</RelativeLayout>
MainActivity.java
package se.mydomain.myapp;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void buttPress(View view) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}
}
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="se.mydomain.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.CAMERA"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="se.mydomain.myapp.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="com.google.zxing.client.android.SCAN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
This is the output in logcat upon launching and then pressing the button. Am I missing something obvious here? This happens both when emulating and when running on a phone, btw.
04-16 13:31:58.313: D/gralloc_goldfish(1359): Emulator without GPU emulation detected.
04-16 13:32:13.034: I/Choreographer(1359): Skipped 82 frames! The application may be doing too much work on its main thread.
04-16 13:32:13.093: W/dalvikvm(1359): VFY: unable to resolve static field 872 (ISSUE_NUMBER) in Lcom/google/zxing/ResultMetadataType;
04-16 13:32:13.103: D/dalvikvm(1359): VFY: replacing opcode 0x62 at 0x0017
04-16 13:32:13.103: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.133: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/ResultPoint;)
04-16 13:32:13.133: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/ResultPoint;)
04-16 13:32:13.133: I/dalvikvm(1359): Could not find method com.google.zxing.ResultPoint.getX, referenced from method com.google.zxing.client.android.CaptureActivity.drawLine
04-16 13:32:13.143: W/dalvikvm(1359): VFY: unable to resolve virtual method 3648: Lcom/google/zxing/ResultPoint;.getX ()F
04-16 13:32:13.143: D/dalvikvm(1359): VFY: replacing opcode 0x6e at 0x0000
04-16 13:32:13.143: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.175: I/dalvikvm(1359): Could not find method com.google.zxing.Result.getResultPoints, referenced from method com.google.zxing.client.android.CaptureActivity.drawResultPoints
04-16 13:32:13.175: W/dalvikvm(1359): VFY: unable to resolve virtual method 3644: Lcom/google/zxing/Result;.getResultPoints ()[Lcom/google/zxing/ResultPoint;
04-16 13:32:13.183: D/dalvikvm(1359): VFY: replacing opcode 0x6e at 0x0003
04-16 13:32:13.183: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.224: I/dalvikvm(1359): Could not find method com.google.zxing.Result.toString, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecodeExternally
04-16 13:32:13.224: W/dalvikvm(1359): VFY: unable to resolve virtual method 3647: Lcom/google/zxing/Result;.toString ()Ljava/lang/String;
04-16 13:32:13.224: D/dalvikvm(1359): VFY: replacing opcode 0x74 at 0x007d
04-16 13:32:13.253: I/dalvikvm(1359): Could not find method com.google.zxing.Result.getText, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecodeExternally
04-16 13:32:13.253: W/dalvikvm(1359): VFY: unable to resolve virtual method 3645: Lcom/google/zxing/Result;.getText ()Ljava/lang/String;
04-16 13:32:13.264: D/dalvikvm(1359): VFY: replacing opcode 0x74 at 0x01c0
04-16 13:32:13.264: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.284: I/dalvikvm(1359): Could not find method com.google.zxing.Result.getBarcodeFormat, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecodeInternally
04-16 13:32:13.284: W/dalvikvm(1359): VFY: unable to resolve virtual method 3641: Lcom/google/zxing/Result;.getBarcodeFormat ()Lcom/google/zxing/BarcodeFormat;
04-16 13:32:13.284: D/dalvikvm(1359): VFY: replacing opcode 0x74 at 0x004c
04-16 13:32:13.324: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.354: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.364: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.384: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.384: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.394: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.394: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.414: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.454: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.454: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.484: I/dalvikvm(1359): Could not find method com.google.zxing.Result.getText, referenced from method com.google.zxing.client.android.CaptureActivity.handleDecode
04-16 13:32:13.494: W/dalvikvm(1359): VFY: unable to resolve virtual method 3645: Lcom/google/zxing/Result;.getText ()Ljava/lang/String;
04-16 13:32:13.494: D/dalvikvm(1359): VFY: replacing opcode 0x6e at 0x0068
04-16 13:32:13.504: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.504: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.524: W/dalvikvm(1359): VFY: unable to find class referenced in signature (Lcom/google/zxing/Result;)
04-16 13:32:13.574: W/dalvikvm(1359): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/zxing/client/android/CaptureActivity;
04-16 13:32:13.584: W/dalvikvm(1359): Class init failed in newInstance call (Lcom/google/zxing/client/android/CaptureActivity;)
04-16 13:32:13.584: D/AndroidRuntime(1359): Shutting down VM
04-16 13:32:13.594: W/dalvikvm(1359): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
04-16 13:32:13.664: E/AndroidRuntime(1359): FATAL EXCEPTION: main
04-16 13:32:13.664: E/AndroidRuntime(1359): java.lang.ExceptionInInitializerError
04-16 13:32:13.664: E/AndroidRuntime(1359): at java.lang.Class.newInstanceImpl(Native Method)
04-16 13:32:13.664: E/AndroidRuntime(1359): at java.lang.Class.newInstance(Class.java:1319)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.os.Handler.dispatchMessage(Handler.java:99)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.os.Looper.loop(Looper.java:137)
04-16 13:32:13.664: E/AndroidRuntime(1359): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-16 13:32:13.664: E/AndroidRuntime(1359): at java.lang.reflect.Method.invokeNative(Native Method)
04-16 13:32:13.664: E/AndroidRuntime(1359): at java.lang.reflect.Method.invoke(Method.java:511)
04-16 13:32:13.664: E/AndroidRuntime(1359): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-16 13:32:13.664: E/AndroidRuntime(1359): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-16 13:32:13.664: E/AndroidRuntime(1359): at dalvik.system.NativeStart.main(Native Method)
04-16 13:32:13.664: E/AndroidRuntime(1359): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
04-16 13:32:13.664: E/AndroidRuntime(1359): at com.google.zxing.client.android.CaptureActivity.<clinit>(CaptureActivity.java:101)
04-16 13:32:13.664: E/AndroidRuntime(1359): ... 15 more
04-16 13:32:19.034: I/Process(1359): Sending signal. PID: 1359 SIG: 9

SDK - R18 still has some bug

Some jar libraries in the libs/ folder are not picked up in some cases.
Just like arcgis for Android sample project "HelloWord", compiled without problems, but can't run properly.
04-16 14:56:33.104: D/dalvikvm(9369): Late-enabling CheckJNI
04-16 14:56:33.134: I/dalvikvm(9369): Turning on JNI app bug workarounds for target SDK version 7...
04-16 14:56:33.234: D/ArcGIS.LifeCycle(9369): map.onChildViewAdded
04-16 14:56:33.244: D/ArcGIS.LifeCycle(9369): map.initLayer
04-16 14:56:33.244: D/ArcGIS.LifeCycle(9369): >>>layer init startcom.esri.android.map.ags.ArcGISTiledMapServiceLayer
04-16 14:56:33.244: D/ArcGIS.LifeCycle(9369): layer init...
04-16 14:56:33.244: W/dalvikvm(9369): VFY: unable to find class referenced in signature (Lorg/codehaus/jackson/JsonNode;)
04-16 14:56:33.244: I/dalvikvm(9369): Could not find method org.codehaus.jackson.JsonNode.get, referenced from method com.esri.android.a.e.a
04-16 14:56:33.244: W/dalvikvm(9369): VFY: unable to resolve virtual method 4781: Lorg/codehaus/jackson/JsonNode;.get (Ljava/lang/String;)Lorg/codehaus/jackson/JsonNode;
04-16 14:56:33.244: D/dalvikvm(9369): VFY: replacing opcode 0x6e at 0x0005
04-16 14:56:33.244: I/dalvikvm(9369): Could not find method
org.codehaus.jackson.JsonNode.getTextValue, referenced from method com.esri.android.a.e.a
04-16 14:56:33.244: W/dalvikvm(9369): VFY: unable to resolve virtual method 4784: Lorg/codehaus/jackson/JsonNode;.getTextValue ()Ljava/lang/String;
04-16 14:56:33.244: D/dalvikvm(9369): VFY: replacing opcode 0x6e at 0x000b
04-16 14:56:33.244: E/HtcAppUsageStatsListener(9369): afterPerformResume
04-16 14:56:33.244: E/HtcAppUsageStatsListener(9369): java.lang.NullPointerException
04-16 14:56:33.244: E/HtcAppUsageStatsListener(9369): at android.app.HtcAppUsageStatsListener.afterPerformResume(HtcAppUsageStatsListener.java:77)
04-16 14:56:33.244: D/ArcGIS.TileCache(9369): max number of cached tiles:1000
04-16 14:56:33.244: D/ArcGIS.LifeCycle(9369): sdcache inited.
04-16 14:56:33.244: D/ArcGIS.TileCache(9369): SDCardCache
04-16 14:56:33.244: E/dalvikvm(9369): Could not find class
'org.codehaus.jackson.JsonFactory', referenced from method com.esri.core.internal.b.a.e.<clinit>
04-16 14:56:33.244: W/dalvikvm(9369): VFY: unable to resolve new-instance 717
(Lorg/codehaus/jackson/JsonFactory;) in Lcom/esri/core/internal/b/a/e;
04-16 14:56:33.244: D/dalvikvm(9369): VFY: replacing opcode 0x22 at 0x0000
04-16 14:56:33.244: W/dalvikvm(9369): VFY: unable to find class referenced in signature (Lorg/codehaus/jackson/JsonFactory;)
04-16 14:56:33.254: I/dalvikvm(9369): Could not find method org.codehaus.jackson.JsonFactory.createJsonParser, referenced from method com.esri.core.internal.b.a.e.a
04-16 14:56:33.254: W/dalvikvm(9369): VFY: unable to resolve virtual method 4760: Lorg/codehaus/jackson/JsonFactory;.createJsonParser
(Ljava/io/InputStream;)Lorg/codehaus/jackson/JsonParser;
04-16 14:56:33.254: D/dalvikvm(9369): VFY: replacing opcode 0x6e at 0x016c
04-16 14:56:33.254: I/dalvikvm(9369): Could not find method org.codehaus.jackson.JsonFactory.createJsonParser, referenced from method com.esri.core.internal.b.a.e.a
04-16 14:56:33.254: W/dalvikvm(9369): VFY: unable to resolve virtual method 4761: Lorg/codehaus/jackson/JsonFactory;.createJsonParser (Ljava/lang/String;)Lorg/codehaus/jackson/JsonParser;
04-16 14:56:33.254: D/dalvikvm(9369): VFY: replacing opcode 0x6e at 0x0022
04-16 14:56:33.254: I/dalvikvm(9369): Could not find method org.codehaus.jackson.JsonFactory.createJsonParser, referenced from method com.esri.core.internal.b.a.e.a
04-16 14:56:33.254: W/dalvikvm(9369): VFY: unable to resolve virtual method 4761:
Lorg/codehaus/jackson/JsonFactory;.createJsonParser (Ljava/lang/String;)Lorg/codehaus/jackson/JsonParser;
04-16 14:56:33.254: D/dalvikvm(9369): VFY: replacing opcode 0x6e at 0x001f
04-16 14:56:33.254: D/dalvikvm(9369): DexOpt: unable to opt direct call 0x1296 at 0x02 in Lcom/esri/core/internal/b/a/e;.<clinit>
04-16 14:56:33.264: W/dalvikvm(9369): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/esri/core/internal/b/a/e;
04-16 14:56:33.274: D/ArcGIS(9369): Failed to initialize the MapView.
04-16 14:56:33.274: D/ArcGIS(9369): java.lang.ExceptionInInitializerError
04-16 14:56:33.274: D/ArcGIS(9369): at com.esri.core.internal.a.a.k.a(Unknown Source)
04-16 14:56:33.274: D/ArcGIS(9369): at com.esri.android.map.ags.ArcGISTiledMapServiceLayer.initModel(Unknown Source)
04-16 14:56:33.274: D/ArcGIS(9369): at com.esri.android.map.ags.ArcGISTiledMapServiceLayer.initModel(Unknown Source)
04-16 14:56:33.274: D/ArcGIS(9369): at com.esri.android.map.LayerView.initLayer(Unknown Source)
04-16 14:56:33.274: D/ArcGIS(9369): at com.esri.android.map.MapView$1.a(Unknown Source)
04-16 14:56:33.274: D/ArcGIS(9369): at com.esri.android.map.MapView$1.call(Unknown Source)
04-16 14:56:33.274: D/ArcGIS(9369): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
04-16 14:56:33.274: D/ArcGIS(9369): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
04-16 14:56:33.274: D/ArcGIS(9369): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
04-16 14:56:33.274: D/ArcGIS(9369): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
04-16 14:56:33.274: D/ArcGIS(9369): at java.lang.Thread.run(Thread.java:864)
04-16 14:56:33.274: D/ArcGIS(9369): Caused by: java.lang.NoClassDefFoundError: org.codehaus.jackson.JsonFactory
04-16 14:56:33.274: D/ArcGIS(9369): at com.esri.core.internal.b.a.e.<clinit>(Unknown Source)
04-16 14:56:33.274: D/ArcGIS(9369): ... 11 more
04-16 14:56:33.274: D/ArcGIS.LifeCycle(9369): sdcard inited.
04-16 14:56:33.294: D/ArcGIS.LifeCycle(9369): map.onSizechanged
04-16 14:56:33.294: D/ArcGIS.LifeCycle(9369): !!! onSizeChangedSignal
04-16 14:56:33.294: D/ArcGIS.LifeCycle(9369): map.onLayout
04-16 14:56:33.304: D/ArcGIS.LifeCycle(9369): map.onLayout
04-16 14:56:33.314: D/memalloc(9369): /dev/pmem: Mapped buffer base:0x51fbc000 size:27017216 offset:24928256 fd:56
we might have encountered the same error - In my case the solution was to separate the Ant targets to two calls (i.e. "ant myParameters myTarget1 myTarget2", and "ant myParameters debug delivery"). Hope this works for you, anyhow - Google need to add better support for their undocumented/faulty changes (and stackoverflow isn't the best place for questions that are not originated in stupidity, as the lifetime of a complex question isn't too long here).
If that doesn't work for you please elaborate your question.

Classcastexception occurs randomly

I've an application in the market and many users have reported that the app is crashing a lot randomly. I'm trying to fix this but cannot fully understand the logs. Here's a extract from the log,
04-16 13:16:32.407 E/AndroidRuntime( 9237): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maya.mobile.chiki/com.maya.mobile.chiki.tabview.Tabs3}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maya.mobile.chiki/com.maya.mobile.chiki.featured.FeaturedView}: java.lang.ClassCastException: android.view.AbsSavedState$1
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.os.Handler.dispatchMessage(Handler.java:99)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.os.Looper.loop(Looper.java:123)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.ActivityThread.main(ActivityThread.java:4363)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at java.lang.reflect.Method.invokeNative(Native Method)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at java.lang.reflect.Method.invoke(Method.java:521)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at dalvik.system.NativeStart.main(Native Method)
04-16 13:16:32.407 E/AndroidRuntime( 9237): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.maya.mobile.chiki/com.maya.mobile.chiki.featured.FeaturedView}: java.lang.ClassCastException: android.view.AbsSavedState$1
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2335)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:648)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.widget.TabHost.setCurrentTab(TabHost.java:320)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at com.maya.mobile.chiki.tabview.CustomTabHost.setCurrentTab(CustomTabHost.java:43)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.widget.TabHost.addTab(TabHost.java:213)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at com.maya.mobile.chiki.tabview.Tabs3.doCreateTabs(Tabs3.java:180)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at com.maya.mobile.chiki.tabview.Tabs3.onCreate(Tabs3.java:149)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
04-16 13:16:32.407 E/AndroidRuntime( 9237): ... 11 more
04-16 13:16:32.407 E/AndroidRuntime( 9237): Caused by: java.lang.ClassCastException: android.view.AbsSavedState$1
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.widget.AbsSpinner.onRestoreInstanceState(AbsSpinner.java:440)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.view.View.dispatchRestoreInstanceState(View.java:5940)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.view.ViewGroup.dispatchThawSelfOnly(ViewGroup.java:1140)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.widget.AdapterView.dispatchRestoreInstanceState(AdapterView.java:767)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1127)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1127)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1127)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1127)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.view.View.restoreHierarchyState(View.java:5919)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1454)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.Activity.onRestoreInstanceState(Activity.java:835)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.Activity.performRestoreInstanceState(Activity.java:807)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1096)
04-16 13:16:32.407 E/AndroidRuntime( 9237): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2473)
04-16 13:16:32.407 E/AndroidRuntime( 9237): ... 22 more
I got this log from one of my users.
Any help on this would be very very helpful.
Regards,
Hari
I was finally able to replicate this issue through an emulator set up with 50MB memory and running on GSM network speed. The issue seems to be because of history being cleared and so the data being lost which the app was already having. Not sure how I can handle this though.. any help???
My guess is that:
You have an activity containing a TabHost (fine)
The contents of those tabs are activities (bad)
You are duplicating android:id values among some of the widgets in those activities (fatal)
I had this issue as well. I had two activities with widgets bearing the same IDs. In one file, this widget was a Button and in another file the widget was a Spinner. I changed the IDs so that the Spinner had a different ID than the Button and the problem went away. It seems that Android runs in to problems if you use the same ID on two different classes of widgets.
I had a similar problem
It was a result of two views [Button] having the same ID
it happend to me because
the eclipse xml editor showed one button but registered 2 of the same ID
I solved it by cutting the button saving and then pasting it and saving again.
see: http://code.google.com/p/android/issues/detail?id=3981
Sometimes this happens to me.
First Try This:
Delete the R.java file so that it regenerates.
Then try this:
I rename the id of the widget in the XML, and in the java.
Then delete the R.java file so it regenerates.
Run it to flush it out. Rename it back to the way it was, and its good to go.

Categories

Resources