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.
Related
I am creating an app on Android, which involves an Activity and a service. One of the components of the service is meant to send a signal to the MainActivity, which will execute some specific code. The problem is, trying to send the intent makes the app crash.
Here is the code that sends the intent. Note that it resides in the inside of a doInBackground function of an AsyncTask object, which resides inside the said service:
#Override
protected String doInBackground(Socket... client) {
Intent received = new Intent();
received.setAction("com.mycompany.Messenger.MESSAGE_RECEIVED");
sendBroadcast(received);
}
Note that if I comment out sendBroadcast(received), the app does not crash.
Here is the handler of the Intent inside MainActivity (which has the name ChatBubbleActivity in my app):
public class MessageReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals(MESSAGE_RECEIVED)) {
String current_message = "Intent works!";
TextView textView = (TextView) findViewById(R.id.myText);
textView.setText(current_message);
}
}
}
And this is the declaration of the Receiver in manifest:
<receiver android:name=".ChatBubbleActivity$MessageReceiver">
<intent-filter>
<action android:name="com.mycompany.Messenger.MESSAGE_RECEIVED"/>
</intent-filter>
</receiver>
, inside the <activity> chunk.
What is it that I might be missing?
EDIT:New version of code based on answers, still crashing.
EDIT logcat:
02-04 16:17:32.444 487-489/? D/dalvikvm﹕ GC_CONCURRENT freed 1662K, 22% free 6885K/8728K, paused 2ms+2ms, total 42ms
02-04 16:17:32.876 1275-1275/? D/AndroidRuntime﹕ >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-04 16:17:32.912 1275-1275/? D/AndroidRuntime﹕ CheckJNI is OFF
02-04 16:17:32.960 1275-1275/? D/dalvikvm﹕ Trying to load lib libjavacore.so 0x0
02-04 16:17:32.964 1275-1275/? D/dalvikvm﹕ Added shared lib libjavacore.so 0x0
02-04 16:17:32.968 1275-1275/? D/dalvikvm﹕ Trying to load lib libnativehelper.so 0x0
02-04 16:17:32.972 1275-1275/? D/dalvikvm﹕ Added shared lib libnativehelper.so 0x0
02-04 16:17:32.972 1275-1275/? D/dalvikvm﹕ No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
02-04 16:17:33.020 1275-1275/? D/dalvikvm﹕ Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
02-04 16:17:33.128 1275-1275/? E/memtrack﹕ Couldn't load memtrack module (No such file or directory)
02-04 16:17:33.132 1275-1275/? E/android.os.Debug﹕ failed to load memtrack module: -2
02-04 16:17:33.264 1275-1275/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am
02-04 16:17:33.284 487-617/? I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.mycompany.messenger/com.mycompany.Messenger.ChatBubbleActivity} from pid 1275
02-04 16:17:33.692 1275-1275/? D/AndroidRuntime﹕ Shutting down VM
02-04 16:17:33.692 1275-1279/? D/dalvikvm﹕ GC_CONCURRENT freed 95K, 15% free 576K/676K, paused 1ms+0ms, total 1ms
02-04 16:17:33.884 487-538/? I/ActivityManager﹕ Start proc com.mycompany.messenger for activity com.mycompany.messenger/com.mycompany.Messenger.ChatBubbleActivity: pid=1286 uid=10059 gids={50059, 3003}
02-04 16:17:33.932 1286-1286/? D/dalvikvm﹕ Late-enabling CheckJNI
02-04 16:17:34.228 1286-1286/? D/dalvikvm﹕ GC_FOR_ALLOC freed 60K, 4% free 2873K/2992K, paused 6ms, total 7ms
02-04 16:17:34.236 1286-1286/? I/dalvikvm-heap﹕ Grow heap (frag case) to 3.338MB for 500412-byte allocation
02-04 16:17:34.248 1286-1295/? D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 4% free 3362K/3484K, paused 11ms, total 11ms
02-04 16:17:34.252 1286-1290/? D/dalvikvm﹕ GC_CONCURRENT freed 0K, 4% free 3362K/3484K, paused 1ms+0ms, total 5ms
02-04 16:17:34.696 1286-1286/? D/libEGL﹕ loaded /system/lib/egl/libEGL_genymotion.so
02-04 16:17:34.708 1286-1286/? D/﹕ HostConnection::get() New Host Connection established 0xb7944cb0, tid 1286
02-04 16:17:34.744 1286-1286/? D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_genymotion.so
02-04 16:17:34.744 1286-1286/? D/libEGL﹕ loaded /system/lib/egl/libGLESv2_genymotion.so
02-04 16:17:34.816 1286-1286/? W/EGL_genymotion﹕ eglSurfaceAttrib not implemented
02-04 16:17:34.820 1286-1286/? E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from GradienCache
02-04 16:17:34.824 1286-1286/? E/OpenGLRenderer﹕ MAX_TEXTURE_SIZE: 8192
02-04 16:17:34.848 1286-1286/? E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
02-04 16:17:34.848 1286-1286/? E/OpenGLRenderer﹕ MAX_TEXTURE_SIZE: 8192
02-04 16:17:34.852 1286-1286/? D/OpenGLRenderer﹕ Enabling debug mode 0
02-04 16:17:34.932 1286-1300/? W/dalvikvm﹕ threadid=12: thread exiting with uncaught exception (group=0xa4d31b20)
02-04 16:17:34.932 1286-1300/? E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #2
Process: com.mycompany.messenger, PID: 1286
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:1050)
at android.app.ContextImpl.startActivity(ContextImpl.java:1037)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:311)
at com.mycompany.Messenger.LocalService$DownloadWebpageTask2.doInBackground(LocalService.java:118)
at com.mycompany.Messenger.LocalService$DownloadWebpageTask2.doInBackground(LocalService.java:113)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
02-04 16:17:34.936 487-617/? W/ActivityManager﹕ Force finishing activity com.mycompany.messenger/com.mycompany.Messenger.ChatBubbleActivity
02-04 16:17:35.180 487-840/? W/InputMethodManagerService﹕ Focus gain on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#529ef2ac (uid=10059 pid=1286)
02-04 16:17:35.288 487-617/? I/WindowManager﹕ Screenshot max retries 4 of Token{52998cec ActivityRecord{5294f214 u0 com.mycompany.messenger/com.mycompany.Messenger.ChatBubbleActivity t4 f}} appWin=Window{52948c58 u0 Starting com.mycompany.messenger} drawState=4
02-04 16:17:35.288 487-617/? W/WindowManager﹕ Screenshot failure taking screenshot for (800x1280) to layer 21015
02-04 16:17:38.512 487-502/? I/Choreographer﹕ Skipped 188 frames! The application may be doing too much work on its main thread.
02-04 16:17:38.516 711-711/? I/Choreographer﹕ Skipped 185 frames! The application may be doing too much work on its main thread.
02-04 16:17:39.708 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:17:40.536 711-711/? W/EGL_genymotion﹕ eglSurfaceAttrib not implemented
02-04 16:17:41.260 487-502/? I/Choreographer﹕ Skipped 35 frames! The application may be doing too much work on its main thread.
02-04 16:17:49.560 1286-1300/? I/Process﹕ Sending signal. PID: 1286 SIG: 9
02-04 16:17:49.580 487-616/? W/InputMethodManagerService﹕ Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#52963b68 attribute=null, token = android.os.BinderProxy#5290713c
02-04 16:17:49.644 487-840/? I/ActivityManager﹕ Process com.mycompany.messenger (pid 1286) has died.
02-04 16:17:49.716 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:17:59.720 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:09.728 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:19.736 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:29.744 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:39.752 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:49.756 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:59.764 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:19:09.772 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:19:19.780 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:19:29.788 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:19:39.792 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:19:49.800 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
Do you want to start an activity or send a broadcast? I don't understand your code.
You are starting an activity from a background thread, that's not allowed.
In your AsyncTask, the method protected String doInBackground(Socket... client) is the only one that doesn't run in the UI thread.
When ever you want to start your Broadcast Receiver you don't call it as an acitivty
Your Method
Intent received = new Intent(ChatBubbleActivity.MESSAGE_RECEIVED);
received.putExtra("current", "Intent is working!!");
startActivity(received);
What it should be
Intent intent = new Intent();
intent.setAction("com.tutorialspoint.CUSTOM_INTENT");
sendBroadcast(intent);
Have a look at these tutorials
Vogella
TutorialsPoint
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.
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
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.
Hi im trying to set up a frame animation with a series of images as a background for my splash page in an android application at the moment there is no errors but when I run the application it quits unexpectedly. The first error which follows 10 garbage collections is E/dalvikvm-heap(276): 1234272-byte external allocation too large for this process. I have 17 images I am using for the frame animation each of them are 50k or less so I dont think that the image sizes can be the issue.
The java code I have implemented in my main activity is as follows:
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView frameanimation = (ImageView) findViewById(R.id.frame_animation);
AnimationDrawable frame_animation = (AnimationDrawable) frameanimation.getBackground();
frame_animation.setVisible(true, true);
frame_animation.start();
}
I then have this code implementing an image view within my XML Layout file:
<ImageView
android:id="#+id/frame_animation"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="#drawable/frame_animation"
android:background="#drawable/frame_animation"/>
and finally I have my animation drawable saved as 'frame_animation.xml' within my drawable folder.
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="#drawable/homebckgrnda1" android:duration="200" />
<item android:drawable="#drawable/homebckgrnda2" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda3" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda4" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda5" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda6" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda7" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda8" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda9" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda10" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda11" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda12" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda13" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda14" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda15" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda16" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda17" android:duration="50" />
</animation-list>
The full LogCat log that I get when running the application is shown here:
04-16 13:51:33.703: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 906 objects / 64688 bytes in 69ms
04-16 13:51:33.983: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 208 objects / 9952 bytes in 66ms
04-16 13:51:34.203: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 54 objects / 2112 bytes in 51ms
04-16 13:51:34.443: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 13 objects / 536 bytes in 52ms
04-16 13:51:34.683: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 13 objects / 512 bytes in 54ms
04-16 13:51:35.133: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 20 objects / 824 bytes in 52ms
04-16 13:51:35.593: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 26 objects / 1216 bytes in 70ms
04-16 13:51:36.023: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 24 objects / 1008 bytes in 51ms
04-16 13:51:36.394: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 26 objects / 1128 bytes in 55ms
04-16 13:51:36.803: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 24 objects / 984 bytes in 50ms
04-16 13:51:37.143: E/dalvikvm-heap(276): 1234272-byte external allocation too large for this process.
04-16 13:51:37.143: E/GraphicsJNI(276): VM won't let us allocate 1234272 bytes
04-16 13:51:37.153: D/AndroidRuntime(276): Shutting down VM
04-16 13:51:37.153: W/dalvikvm(276): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-16 13:51:37.203: E/AndroidRuntime(276): FATAL EXCEPTION: main
04-16 13:51:37.203: E/AndroidRuntime(276): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.BadmintonTrain/com.android.BadmintonTrain.BadmintonTrainActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class android.widget.ImageView
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.os.Handler.dispatchMessage(Handler.java:99)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.os.Looper.loop(Looper.java:123)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-16 13:51:37.203: E/AndroidRuntime(276): at java.lang.reflect.Method.invokeNative(Native Method)
04-16 13:51:37.203: E/AndroidRuntime(276): at java.lang.reflect.Method.invoke(Method.java:521)
04-16 13:51:37.203: E/AndroidRuntime(276): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-16 13:51:37.203: E/AndroidRuntime(276): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-16 13:51:37.203: E/AndroidRuntime(276): at dalvik.system.NativeStart.main(Native Method)
04-16 13:51:37.203: E/AndroidRuntime(276): Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class android.widget.ImageView
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
04-16 13:51:37.203: E/AndroidRuntime(276): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-16 13:51:37.203: E/AndroidRuntime(276): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.Activity.setContentView(Activity.java:1647)
04-16 13:51:37.203: E/AndroidRuntime(276): at com.android.BadmintonTrain.BadmintonTrainActivity.onCreate(BadmintonTrainActivity.java:21)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-16 13:51:37.203: E/AndroidRuntime(276): ... 11 more
04-16 13:51:37.203: E/AndroidRuntime(276): Caused by: java.lang.reflect.InvocationTargetException
04-16 13:51:37.203: E/AndroidRuntime(276): at android.widget.ImageView.<init>(ImageView.java:108)
04-16 13:51:37.203: E/AndroidRuntime(276): at java.lang.reflect.Constructor.constructNative(Native Method)
04-16 13:51:37.203: E/AndroidRuntime(276): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
04-16 13:51:37.203: E/AndroidRuntime(276): ... 22 more
04-16 13:51:37.203: E/AndroidRuntime(276): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.Bitmap.nativeCreate(Native Method)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.content.res.Resources.loadDrawable(Resources.java:1709)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.content.res.Resources.getDrawable(Resources.java:581)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.drawable.AnimationDrawable.inflate(AnimationDrawable.java:265)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.content.res.Resources.loadDrawable(Resources.java:1694)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.View.<init>(View.java:1885)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.widget.ImageView.<init>(ImageView.java:112)
Any help is much appreciated, I just cannot figure out what is causing the problem.
Thanks
The images you are using might be too large for an animation. How large are they? In an animation, Android loads all of the images into memory and uncompresses them meaning that every pixel will take 4 bytes. So 50k would mean that your image is 111px x 111px. It seems from the error each frame is about 480 x 640, which is really large. Try using smaller images.