I'm trying to build Dolphin Player, but I got his error:
[2012-09-21 09:46:23 - DolphinPlayer] Installation failed due to invalid APK file!
[2012-09-21 09:46:23 - DolphinPlayer] Please check logcat output for more details.
[2012-09-21 09:46:23 - DolphinPlayer] Launch canceled!
09-21 09:32:15.460: W/PackageParser(52): Unknown element under <application>: intent-filter at /data/app/vmdl30455.tmp Binary XML file line #31
09-21 09:32:17.360: E/PackageManager(52): Package com.broov.player has mismatched uid: 10031 on disk, 10035 in settings
09-21 09:32:17.370: I/PackageManager(52): /data/app/vmdl30455.tmp changed; unpacking
09-21 09:32:17.390: W/PackageManager(52): Native ABI mismatch from package file
09-21 09:32:17.400: W/PackageManager(52): Package couldn't be installed in /data/app/com.broov.player.apk
09-21 09:32:17.460: D/AndroidRuntime(833): Shutting down VM
09-21 09:32:17.460: D/dalvikvm(833): DestroyJavaVM waiting for non-daemon threads to exit
09-21 09:32:17.460: D/dalvikvm(833): DestroyJavaVM shutting VM down
09-21 09:32:17.460: D/dalvikvm(833): HeapWorker thread shutting down
09-21 09:32:17.460: D/dalvikvm(833): HeapWorker thread has shut down
09-21 09:32:17.470: D/jdwp(833): JDWP shutting down net...
09-21 09:32:17.470: I/dalvikvm(833): Debugger has detached; object registry had 1 entries
09-21 09:32:17.480: D/dalvikvm(833): VM cleaning up
09-21 09:32:17.480: E/AndroidRuntime(833): ERROR: thread attach failed
09-21 09:32:17.490: D/dalvikvm(833): LinearAlloc 0x0 used 631172 of 5242880 (12%)
09-21 09:32:17.669: D/dalvikvm(52): GC freed 8681 objects / 526608 bytes in 239ms
: E/(): Device disconnected
It looks like in your AndroidManifest.xml file something has gone wrong. An intent-filter in the wrong place maybe? I think it need to be within an <activity> tag, not within the <application> tag.
I have same error when I am running the application then I deleted the bin folder and cleaned project and run again, It is again created bin folder and run without any errors.
May be two cases.
AndroidManifest.xml
Included .jar file also may be the cause of this problem.
for more information take a look
Eclipse installation failed due to invalid APK file?
OR
Installation failed due to invalid APK file?
OR
Installation failed due to invalid APK file! - Android
OR
Installation failed - invalid apk file - android_opencv_library
Build > Rebuild Project..
Fixed the issue for me
step 1: In my case, I deleted the app-debug.apk in ...\android\app\build\outputs\apk\debug folder.
step 2: Then run again.
That's work for me.
Good luck.Never Give up!!!
Related
TL;DR: When updating system apps on android, the updated app is only started after reboot.
I am developing a custom ROM based on Android 8.1.2 for a custom device based on Rockchip RK3126c. I took the AOSP source from the board manufacturer and only modified the platform key and added two custom apps as system apps; one is privileged (shared system user), and one isn't, i.e. the first is located in /system/priv-app and signed with the platform key, and the second in /system/app and signed with its own key.
Both apps work, but when I try to update any of the two (via adb shell pm install -r ... or via Android Studio) the update doesn't take effect; the old version still runs, even after killing (adb shell kill -9 ... or throwing a null pointer exception) and restarting it. Only after a full reboot is the new version started. I did increment the versionCode. Before the reboot, getPackageManager().getPackageInfo(...).versionCode yields the new version number, while BuildConfig.VERSION_CODE gives the old one. This is both for eng and user builds.
While updating, adb logcat shows:
10-17 15:45:19.706 1048 1048 D AndroidRuntime: Calling main entry com.android.commands.pm.Pm
10-17 15:45:19.725 1058 1058 E asset : setgid: Operation not permitted
10-17 15:45:22.563 336 362 I ActivityManager: Start proc 1062:com.android.defcontainer/u0a11 for service com.android.defcontainer/.DefaultContainerService
10-17 15:45:22.617 1062 1062 I zygote : The ClassLoaderContext is a special shared library.
10-17 15:45:22.739 336 362 I chatty : uid=1000(system) PackageManager expire 1 line
10-17 15:45:22.820 1077 1077 I dex2oat : /system/bin/dex2oat --input-vdex-fd=-1 --output-vdex-fd=14 --compiler-filter=quicken --classpath-dir=/data/app/com.example.myapp-cdF84NESHVxl5UTZHVbRdg== --class-loader-context=PCL[]
10-17 15:45:22.832 1077 1077 W dex2oat : Could not reserve sentinel fault page
10-17 15:45:26.117 1077 1080 W dex2oat : Verification of boolean ao0.a(java.lang.String, long) took 130.568ms
10-17 15:45:28.960 1077 1077 I dex2oat : dex2oat took 6.142s (10.744s cpu) (threads: 4) arena alloc=17KB (17568B) java alloc=4MB (4274432B) native alloc=6MB (6543768B) free=1801KB (1844840B)
10-17 15:45:28.997 336 350 I ActivityManager: Force stopping com.example.myapp appid=1000 user=-1: installPackageLI
10-17 15:45:29.009 336 362 W PackageManager: Trying to update system app code path from /system/priv-app/MyApp to /data/app/MyApp-cdF84NESHVxl5UTZHVbRdg==
10-17 15:45:29.010 336 362 W PackageManager: Code path for com.example.myapp changing from /system/priv-app/MyApp to /data/app/MyApp-cdF84NESHVxl5UTZHVbRdg==
10-17 15:45:29.010 336 362 W PackageManager: Resource path com.example.myapp changing from /system/priv-app/MyApp to /data/app/MyApp-cdF84NESHVxl5UTZHVbRdg==
10-17 15:45:29.205 242 242 E : Couldn't opendir /data/app/vmdl1968223466.tmp: No such file or directory
10-17 15:45:29.205 242 242 E installd: Failed to delete /data/app/vmdl1968223466.tmp: No such file or directory
10-17 15:45:29.213 336 362 I ActivityManager: Force stopping com.example.myapp appid=1000 user=0: pkg removed
10-17 15:45:29.214 1048 1048 I Pm : Package com.example.myapp installed in 9500 ms
10-17 15:45:29.239 1048 1048 I app_process: System.exit called, status: 0
10-17 15:45:29.239 1048 1048 I AndroidRuntime: VM exiting with result code 0.
After the reboot, further updates to the app do work - apparently, the problem only exists when changing the code path from /system/[priv-]app to /data/app, but not when the path is already /data/app.
The same thing worked fine on Android 7.1.2. Deep within the android framework there is probably some cache for the code paths of the apps which doesn't get updated after the app is overwritten. Anyone knows where that is located and how to fix this problem?
After a lot of fiddling, I found it myself: The app was marked as persistent in the manifest, which causes the mentioned behaviour. It only worked on Android 7.1.2 because there was a vendor-specific modification that ignored the persistent flag.
When I try to debug my app I am getting this error: Failure [INSTALL_FAILED_DEXOPT]
I am using Android Studio 0.8.1.
This is the log when I am trying to install and debug the app.
Installing <mypackage>
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/<mypackage>"
pkg: /data/local/tmp/<mypackage>
Failure [INSTALL_FAILED_DEXOPT]
Now it happens with all apps in my IDE, with all my real and virtual devices.
Logcat:
07-09 01:34:53.895 585-609/? I/PackageManager﹕ Running dexopt on: mypackage
07-09 01:34:53.915 17728-17728/? W/dalvikvm﹕ DexOptZ: zip archive '/data/app/mypackage-1.apk' does not include classes.dex
07-09 01:34:53.915 177-177/? W/installd﹕ DexInv: --- END '/data/app/mypackage-1.apk' --- status=0xff00, process failed
07-09 01:34:53.915 177-177/? E/installd﹕ dexopt in='/data/app/mypackage.apk' out='/data/dalvik-cache/data#app#mypackage-1.apk#classes.dex' res=65280
07-09 01:34:53.915 585-609/? W/PackageManager﹕ Couldn't delete native library directory /data/app-lib/mypackage
In my case this error appeared when i enabled again Instant Run. By disabling it dissapeared.
Solved invalidating the cache and deleting the .AndroidStudioBeta folder
To invalidate the cache use in Android Studio: File -> Invalidate Caches and restart
I faced the same problem. I have done the following steps to fix it
Android studio -> Build -> Clean Project
Android studio -> Build -> Rebuild Project
Use ProGuard to optimize your code.
After reading a zillion posts on how to make a referenced library work with Android-Eclipse I must declare failure to run the provided sample tic-tac-toe, which is split into two projects TicTacToeLib (marked as library) and TicTacToeMain (which uses TicTacToeLib)
I first imported created TicTacToeLib into Eclipse (File->New->Other->Android->Android sample project->TicTacToeLib)
Then imported created TicTacToeMain into Eclipse (File->New->Other->Android->Android sample project->TicTacToeMain)
Followed the instructions on the Android Developers site on how to setup and reference a library project
Here I encounter the first obstacle, because on one hand the site mentions that <user-library> should be used, but the example Manifest for TicTacToeMain does not contain any <uses-library> element.
Either way the example does not run.
Without <user-library> element the project does not even compile:
If I add the tictactoelib.jar to the build path manually (Add JARs...), which is not part of the instructed steps in the Android Developers page, the errors dissapear, only the warnings remain. Running the app exits with failure (" Unfortunately Tic Tac Toe Sample has stopped "):
04-08 16:05:24.762: E/dalvikvm(3741): Could not find class 'com.example.android.tictactoe.library.GameActivity', referenced from method com.example.android.tictactoe.MainActivity.startGame
04-08 16:05:24.762: W/dalvikvm(3741): VFY: unable to resolve const-class 17 (Lcom/example/android/tictactoe/library/GameActivity;) in Lcom/example/android/tictactoe/MainActivity;
04-08 16:05:24.767: D/dalvikvm(3741): VFY: replacing opcode 0x1c at 0x0002
04-08 16:05:24.877: V/PhoneStatusBar(166): setLightsOn(true)
04-08 16:05:24.937: D/gralloc_goldfish(3741): Emulator without GPU emulation detected.
04-08 16:05:25.017: I/Process(89): Sending signal. PID: 3741 SIG: 3
04-08 16:05:25.027: I/dalvikvm(3741): threadid=3: reacting to signal 3
04-08 16:05:25.037: I/dalvikvm(3741): Wrote stack traces to '/data/anr/traces.txt'
04-08 16:05:25.058: I/ActivityManager(89): Displayed com.example.android.tictactoe/.MainActivity: +1s368ms
04-08 16:05:25.317: W/NetworkManagementSocketTagger(89): setKernelCountSet(10013, 0) failed with errno -2
04-08 16:05:27.857: D/AndroidRuntime(3741): Shutting down VM
04-08 16:05:27.857: W/dalvikvm(3741): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
04-08 16:05:27.918: E/AndroidRuntime(3741): FATAL EXCEPTION: main
04-08 16:05:27.918: E/AndroidRuntime(3741): java.lang.NoClassDefFoundError: com.example.android.tictactoe.library.GameActivity
04-08 16:05:27.918: E/AndroidRuntime(3741): at com.example.android.tictactoe.MainActivity.startGame(MainActivity.java:51)
04-08 16:05:27.918: E/AndroidRuntime(3741): at com.example.android.tictactoe.MainActivity.access$0(MainActivity.java:50)
04-08 16:05:27.918: E/AndroidRuntime(3741): at com.example.android.tictactoe.MainActivity$1.onClick(MainActivity.java:38)
04-08 16:05:27.918: E/AndroidRuntime(3741): at android.view.View.performClick(View.java:3511)
04-08 16:05:27.918: E/AndroidRuntime(3741): at android.view.View$PerformClick.run(View.java:14105)
Adding the following line to the TicTacToeMain manifest:
<uses-library android:name="com.example.android.tictactoe.library"/>
does not even launch the app:
[2013-04-08 19:13:03 - TicTacToeMain] Android Launch!
[2013-04-08 19:13:03 - TicTacToeMain] adb is running normally.
[2013-04-08 19:13:03 - TicTacToeMain] Performing com.example.android.tictactoe.MainActivity activity launch
[2013-04-08 19:13:03 - TicTacToeMain] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Smartphone_ics'
[2013-04-08 19:13:03 - TicTacToeMain] Uploading TicTacToeMain.apk onto device 'emulator-5554'
[2013-04-08 19:13:03 - TicTacToeMain] Installing TicTacToeMain.apk...
[2013-04-08 19:13:06 - TicTacToeMain] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2013-04-08 19:13:06 - TicTacToeMain] Please check logcat output for more details.
[2013-04-08 19:13:06 - TicTacToeMain] Launch canceled!
I tried other things, none solved the problem:
Changed the target TicTacToeMain version to 15, to 10
Added the TicTacToeLib as User Library in the build path
Created a libs folder for TicTacToeMain, and copied tictactoelib.jar, did not solve, imported the tictactoelib.jar uising Import..., no sugar
The reason I want this sample to work, besides understadning how to the mechnaism for referenced libraries work, is that I want to create a complex app, using many referenced libraries and if I cannot make this silly sample work, then I will not be able to.
One more point, adding the reference library project to TicTacToeMain:
It does not stick, I press Apply as instructed, then OK. But when I open the Project's properties again (no run, no compile, just reopen):
Maybe this is the real symptom, but I don't know what else to try.
I use Eclipse 4.2.1, Android SDK 21.1, Java IDE 1.5.1
Target Java Compliance level is 1.6
I tried several AVDs emulators, all show the same problem.
about the reference library
This error means that your TicTacToLib is using from another project, to solve this error you have to :
copy the tictactolib.
delete that project which is using the tictactolib and check the remove from the hard disk.
past the tictactolib to the old path.
try again and the error will be gone.
Note:ofc, you can just un import the library from the project which is using it right now without deleting that project.
It is just to do a new-project-android->Android Sample Project->Tictactoemain/lib. Do not import, just a new project and it works. In any case right click on project name -> Android Tools -> Fix Project Properties and in the menu Project-> Clean.
Maybe another clean workspace or new emulator device (is it correctly setup?)? You have all java, android sdk, adt and so on? I have no such problems.
This voodoo process finally got the project to compile and run properly.
I still don't know what is it that made the difference, so if you understand, please edit this asnwer and complete the explanation.
Process:
After many unsuccsessful tries I decided to export the JAR file from TicTacToeLib project and add the exported JAR to the TicTacToeMain project. Doing that solved the ClassNotFound exception but created a new problem: duplicates resource IDs (see this post).
So I deleted the imported JAR from the libs directory and from the build path and just by a desperate act I went to TicTacToeMain propeties->Android and added TicTacToeLib as reference. I've done this before at least 4 times and it did not work. I don't know why I even tried it again.
This time I noticed at the edge of my vision that something changed in the Package Explorer pane in Eclipse. I discovered that something was added under TicTactToeMain/gen. A com.example.tictactoe.library folder containing a R.java file with renumbered ID's that do not conflict with the main project's IDs. This has never happened before in my other attemps to add a reference library. So I run the app and this time it ran OK.
As I said, at this point this is voodoo to me, I don't know what I did different now than in the previous 4 times I tried the same.
My Android app APK is fairly large at ~480 MB. I can install the app just fine but on Android OS 2.2 when the app is launched I get this error (in logcat):
09-21 00:04:12.855: W/dalvikvm(3178): mmap(480331001, RO, FILE|SHARED, 28, 0) failed: Out of memory
09-21 00:04:12.855: W/dalvikvm(3178): Map of '/data/app/com.mycompany.myapp-1.apk' failed
09-21 00:04:12.855: D/AndroidRuntime(3178): Shutting down VM
09-21 00:04:12.855: W/dalvikvm(3178): threadid=1: thread exiting with uncaught exception (group=0x4001d828)
09-21 00:04:12.859: E/AndroidRuntime(3178): FATAL EXCEPTION: main
09-21 00:04:12.859: E/AndroidRuntime(3178): java.lang.RuntimeException: Unable to instantiate activity
...
This does not happen on OS 4.0+. Some users are reporting a crash on startup in 2.3.4 and 2.3.7, which I suspect is the same problem. Why is mmap failing on my APK?
EDIT: I know the app is very large (it's a game with lots of assets) and the Play Store limits APKs to 50 MB, but this is for a carrier in another country that has no APK size limit. I already have a version of the app on the Play Store with an APK of ~20MB that makes use of expansion files which exhibits no mmap problems.
Just a guess but on first run try copying the file to user memory, then mapping it from there.
I'm trying the Hello World example from https://android.googlesource.com/platform/dalvik/+/gingerbread/docs/hello-world.html
However, my Foo program did not run; dalvikvm complained about the following:
Dalvik VM unable to locate class 'Foo'
java.lang.NoClassDefFoundError: Foo
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Foo in loader dalvik.system.PathClassLoader[/mnt/sdcard/foo.jar]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
... 1 more
Logcat gave more information during the dalvikvm invocation:
D/dalvikvm( 1361): creating instr width table
E/dalvikvm( 1361): Can't open dex cache '/data/dalvik-cache/mnt#sdcard#foo.jar#classes.dex': No such file or directory
I/dalvikvm( 1361): Unable to open or create cache for /mnt/sdcard/foo.jar (/data
/dalvik-cache/mnt#sdcard#foo.jar#classes.dex)
W/dalvikvm( 1361): threadid=1: thread exiting with uncaught exception (group=0x4
001e9a8)
Does anyone out there know what I did wrong?
The author of the article, Andy McFadden, give me a tip:
It's trying to create a .odex file in /data/dalvik-cache. You'll
need to be running as root, or have an unprotected
/data/dalvik-cache.
Once I rooted my device (e.g. using SuperOneClick), it worked!
Comment by #domen: You don't actually have to be root. You can set ANDROID_DATA environment variable and it will put cache there. I.e. mkdir /data/local/tmp/dalvik-cache, export ANDROID_DATA=/data/local/tmp.
It seems like you are trying to run it as a jar file from the sdcard. You need to use the tools to build it as an apk file. This converts from Java bytecodes to Dalvik codes, and reorganizes the contents of the file.