Android emulator not installed app - android

Installation failed since the device possibly has stale dexed jars that don't match the current version (dexopt error). In order to proceed, you have to uninstall the existing application.
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.tell_it_dell.myapplication1"
pkg: /data/local/tmp/com.example.tell_it_dell.myapplication1
Failure [INSTALL_FAILED_DEXOPT]
DEVICE SHELL COMMAND: pm uninstall com.example.tell_it_dell.myapplication1
DELETE_FAILED_INTERNAL_ERROR
How do I solve this?

What I did to fix it, is to open gradlew via cmd, and write "gradlew clean" on the project. Then pressed play button and it worked again.

Related

getting Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI] in Android studio 3.0

As per this blogpost from CommonsWare, AndroidManifest.xml file can have an android:testOnly attribute.
In my AndroidManifest.xml it is set as "false"
android:testOnly="false"
And I am generating the apk file using the “Build APK(s)” menu option as shown below image,
And when i am trying to install app from command line, adb install -r myapp.apk, I am still getting error,
Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]
Android studio version is as below,
What else shall I do to make my app run?
You can also use command like this :
adb install -r -t myapp.apk
it works for me:
PS C:\Users\languoguang> adb -P 12345 install -r D:\GreeneTrans\HelloWorld-signed.apk
adb: failed to install D:\GreeneTrans\HelloWorld-signed.apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]
PS C:\Users\languoguang> adb -P 12345 install -t D:\GreeneTrans\HelloWorld-signed.apk
Success
PS C:\Users\languoguang> adb -P 12345 install -r -t D:\GreeneTrans\HelloWorld-signed.apk
Success
PS C:\Users\languoguang>
Just use the following command:
adb install -t app/build/outputs/apk/debug/app-debug.apk
You do not need to use -r, -r means Reinstall an existing app, keeping its data.
Install an app You can use adb to install an APK on an emulator or
connected device with the install command:
adb install path_to_apk
You must use the -t option with the install command when you install a
test APK. For more information, see -t.
https://developer.android.com/studio/command-line/adb#move
-t: Allow test APKs to be installed. Gradle generates a test APK when you have only run or debugged your app or have used the Android Studio
Build > Build APK command. If the APK is built using a developer
preview SDK (if the targetSdkVersion is a letter instead of a number),
you must include the -t option with the install command if you are
installing a test APK.
https://developer.android.com/studio/command-line/adb#-t-option
Or you could use the same command as you click Run in Android Studio
adb push {project dir}/app/build/outputs/apk/debug/app-debug.apk /data/local/tmp/{appId}
adb shell pm install -t /data/local/tmp/{appId}
appId is defined in the app/build.gradle.
defaultConfig {
applicationId appId
Now the app is installed from locally on the device
Launch the first activity.
adb shell am start -n "{package name}/{package name}.splash.SplashActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
2019-11-13 13:43 Gradle sync started
13:44 Project setup started
13:44 Executing tasks: [:app:generateDebugSources,
:vplus_explore:generateDebugSources,
:vplus_uibase:generateDebugSources,
:vplus_widget:generateDebugSources,
:vplus_runtime:generateDebugSources,
:vplus_cards:generateDebugSources,
:vplus_launcher:generateDebugSources,
:vplus_settings:generateDebugSources,
:vplus_transactions:generateDebugSources,
:vplus_payment:generateDebugSources,
:vplus_common:generateDebugSources,
:vplus_account:generateDebugSources,
:vplus_commonres:generateDebugSources,
:vplus_bootstrap:generateDebugSources,
:vplus_logger:generateDebugSources]
13:44 Gradle sync finished in 27 s 126 ms
13:44 Gradle build finished in 4 s 666 ms
13:45 * daemon not running; starting now at tcp:5037
13:45 * daemon started successfully
13:45 Executing tasks: [:app:assembleDebug]
13:46 Gradle build finished in 33 s 640 ms
If you really want to be able to remove the test flag from the APK generated in Android Studio, you could try adding the following to your gradle.properties file:
android.injected.testOnly = false
Solution 1
Click drop-down menu with your configuration and choose Edit Configurations…
Select tab General and add -t to Install Flags field. Click Ok.
Now start the application again and it should work.
Solution 2
This means that, the shared application has some test packages, so
unless those has been removed and source is recompiled, you will not
be able to install this apk. But adb command provides a flag “-t”
using which you can install the apps with test packages.
$ adb install -r -t YourAndroidApp.apk
2566 KB/s (7266004 bytes in 2.764s)
Success
Solution 3
This error might occur if you moved the project from other computer where it was stored in different directory. To resolve the problem: Clean the project and build it again.
Solution 4
Go to “Settings” -> “Build, execution, deployment” and disable “instant run to hot swap code…”
Solution 5
Add this line to gradle.properties:
android.injected.testOnly = false
If you would like to manually install an APK or give it to someone for manual installation using the following adb command, then you should only build the APK from the Menu bar -> Build -> Build Bundle/APK.
adb install -r xyz.apk
Do not click on the play button as it builds the APK for test purposes only. Clicking on the play button overrides the APK in the default location which can then be installed manually by using the following command only.
adb install -r -t xyz.apk

Getting an error when Android apk is tried to deploy external device

Launching app
$ adb push /app/build/outputs/apk/prelollipop/debug/XXX.apk /data/local/tmp/XXX.android
$ adb shell pm install -t -r "/data/local/tmp/XXX.android"
Failure [INSTALL_FAILED_INVALID_APK: Package couldn't be installed in /data/app/XXX.android-1: Package /data/app/com.ozan.android-1/base.apk code is missing]
$ adb shell pm uninstall XXX.android
Unknown failure (at android.os.Binder.execTransact(Binder.java:573))
Error while Installing APK
I am getting this error when i try to deploy app to external device after codes successfully build on Android Studio 3.0.
Also i use Dexguard v8.1.01. However if i build the apk with dexguard .apk is successfully deploy the device. the problem is occured without dexguard build.
Any idea to fix it?

ReactNative app is successfully installed but it's not started from WebStorm

When I try to build ReactNative app for my devices I get this:
BUILD SUCCESSFUL
Total time: 25.191 secs
This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Starting the app (adb shell am start -n com.neborofeed/com.neborofeed.MainActivity.../bin/sh: adb: command not found
The app is installed on my device, but it's not started automatically. When I copy this command to the terminal adb shell am start -n com.neborofeed/com.neborofeed.MainActivity, the app is started as expected.
It's seems that the script is not able to find adb, have you added the PATH in your ~/.bash_profile or similar?
If you have not try running:
echo "export PATH=\$PATH:/Users/${USER}/Library/Android/sdk/platform-tools/" >> ~/.bash_profile
If you have your sdk in a different directory, then update the path in the command above.
I have tried with this one then work for me after restart MAC
Noted: Don't forget to restart your MAC

Failure [INSTALL_FAILED_TEST_ONLY] Error while Installing APK [duplicate]

I am having issues installing an apk to my device.
adb install <.apk>
Using the above command returns the following:
5413 KB/s (99747 bytes in 0.017s)
pkg: /data/local/tmp/AppClient.TestOnly.App3.apk
Failure [INSTALL_FAILED_TEST_ONLY]
Any idea on what might cause this issue?
It definitely recognizes the device. Could it be an issue with the apk?
Looks like you need to modify your AndroidManifest.xml
Change android:testOnly="true" to android:testOnly="false" or remove this attribute.
If you want to keep the attribute android:testOnly as true you can use pm install command with -t option, but you may need to push the apk to device first.
$ adb push bin/hello.apk /tmp/
5210 KB/s (825660 bytes in 0.154s)
$ adb shell pm install /tmp/hello.apk
pkg: /tmp/hello.apk
Failure [INSTALL_FAILED_TEST_ONLY]
$ adb shell pm install -t /tmp/hello.apk
pkg: /tmp/hello.apk
Success
I was able to reproduce the same issue and the above solved it.
If your APK is outside the device (on your desktop), then below command would do it:
$ adb install -t hello.apk
I had a similar problem with Android Studio 3.0.0 Beta 7 and could not publish anymore to the play store.
As stated here: https://developer.android.com/studio/run/index.html
Note: The Run button builds an APK with testOnly="true", which means
the APK can only be installed via adb (which Android Studio uses). If
you want a debuggable APK that people can install without adb, select
your debug variant and click Build > Build APK(s).
Same goes for release build, with Android Studio 3 you need to go to Build > Build APK(s) to have a non testable release apk that you can submit to the store.
Add -t install flag, as on the screenshot below:
In my case this mistake was in unstable gradle version. Just use a stable version of gradle (not alpha, not even beta). And it was fixed for me
After searching and browsing all day, the only one works is adding
android.injected.testOnly=false
to the gradle.properties file
I agree with Elisey. I got this same error after opening my project in the 2.4 preview and then opening the same project in android studio 2.3
Fixed the issue by changing this line in build.gradle from
classpath 'com.android.tools.build:gradle:2.4.0-alpha5'
to
classpath 'com.android.tools.build:gradle:2.3.1'
None of the previous post solve my issue. Here is what's happening with me:
I normally load the app from android studio by clicking on the "Run" button. When you do this, android would create an app that's good for debug but not for install. If you try to install using:
adb install -r yourapk
you will get a message that says:
Failure [INSTALL_FAILED_TEST_ONLY]
When this happens, you will need to rebuilt the apk by first clean the build, then select Build->Build APK. See the image bellow:
This APK is ready to be installed either through adb install command or any other methods
Hope this helps
David
Android studio 3.0 generates test only APK.
I have solved the issue by adding the "android:testOnly" property to android manifest's tag.
<application
.....
android:testOnly="false"
android:theme="#style/AppTheme">
And then generated the APK by Android studio3.0 menu:Build-->Build APK(s).
More Info:
https://commonsware.com/blog/2017/10/31/android-studio-3p0-flag-test-only.html
add this line to your ‘gradle.properties’
android.injected.testOnly=false
If you want to test the apk, just add the -t command line option.
Example command:
adb install -t .\app-debug.apk
In my case was by uploading an APK, that although it was signed with production certificate and was a release variant, was generated by the run play button from Android studio.
Problem solved after generating APK from Gradle or from Build APK menu option.
In my case, using Android Studio 4.0, the below solved the issue;
Add to 'gradle.properties' file;
android.injected.testOnly=false
Android 3.6.2 or later
Build >> Build/Bundle apk >> Build apk
Its working fine.
I see the accepted answer but you dont have to actually push the apk and then run the command on adb shell direct adb install with -t flag actually works
adb install -t "path to apk in ur computer"
attaching a screenshot for reference
This works for me:
adb install -t myapk.apk
The easiest to solve this, without reverting to an older gradle version is to add the '-t' option in the run configurations (for pm install).
testOnly='false' had no effect whatsoever. The error is caused by the alpha version of gradle plugin that makes debug APK 'for test only purposes'. The -t option allows such APK to be installed. Setting it in run configuration makes it automatically install you APK as usual.
My finding is as below. If I compile using the Android Studio UI, and the APK generated, I can't just
adb install <xxx.apk>
It will generate Failure [INSTALL_FAILED_TEST_ONLY]
I need to compile it using the gradle i.e. ./gradlew app:assembleRelease. Then only the generated apk, then it can only be installed.
This is because the Android Studio UI Compile, only generate test apk for a particular device, while ./gradlew app:assembleRelease command is the actual apk generation to be installed on all device (and upload to playstore)
I don't know if it's gonna be useful for anyone or not, but I got this error message, when I accidentally tried to build and install my project with test gradle plugin ('gradle:2.4.0-alpha5') version in stable Android Studio version (2.3, not in 2.4 preview 5 version I'd downloaded and installed before).
When I realized my mistake, I launched preview Android Studio version and it built and installed my project without any problem.
As mentioned in documentation:
Android Studio automatically adds this attribute when you click Run
So, to be able to install your apk with adb install <path to apk file> you need to assemble build from terminal: ./gradlew assembleDebug and install with adb. Or just run ./gradlew installDebug to build and install on the device simultaneously.
Build your distribution .apk from Android Studio as follow
Build --> Build Apk(s) (for unsigned build)
Build --> Generate Signed APK ( for signed build)
These option builds the APK with android:testOnly="false" option which allows you to install the APK expicitly into device by the commond.
adb install yourBuilT.apk
What worked for me is performing Refresh all Gradle projects from the Gradle toolbar from the right menu.
PFB the screenshot from Android Studio.
Select Gradle toolbar from the right menu.
Select the Refresh icon
This resolved the issue for me.
Although I am sure Saurabh's answer will work for most other people, I did want to identify the extra steps I had to take in order to get my apk installed.
I tried pushing to the device with the following result:
? adb push AppClient.TestOnly.App3.apk \tmp\
failed to copy 'AppClient.TestOnly.App3.apk' to '\tmp\': Read-only file system
After looking around to change the filesystem RW permissions I ended up executing the following commands:
? adb shell
255|shell#android:/ $ su
shell#android:/ # mount -o remount,rw /
mount -o remount,rw /
I got this when I tried to push again:
? adb push AppClient.TestOnly.App3.apk /tmp
failed to copy 'AppClient.TestOnly.App3.apk' to '/tmp': Permission denied
I was able to push to the sdcard:
? adb push AppClient.TestOnly.App3.apk /sdcard/
3178 KB/s (99747 bytes in 0.030s)
At which point I was able to execute Saurabh's command:
shell#android:/ # pm install -t /sdcard/AppClient.TestOnly.App3.apk
pm install -t /sdcard/AppClient.TestOnly.App3.apk
pkg: /sdcard/AppClient.TestOnly.App3.apk
Success
For me it has worked execute the gradle task 'clean' (under :app, at Gradle pane, usually located at the right) and run again the project.
I tried external project, with multiple apk.
The command from Studio, looked like
adb install-multiple -r ....
Solution -
select console
aste command with -t
If you are looking for a less permanent solution then adding android.injected.testOnly=false to your gradle.properties file and you don't mind using the command line then the following two commands before installation will do:
rm -v **/build/**/AndroidManifest.xml
gradle build
For Windows users: delete all AndroidManifest.xml from all build directories. But not from the src directories so DEL /S is not the best idea.
I got the same issue and no answer helps.
At last, I find there's still an install in my Safe Folder(Or Secure folder depending phone brands), which had not been removed when Android uninstalled the ordinary install. Remove it and this issue fixed.
Hope this can help some guys else!
first remove the unstable version:
adb uninstall problematic-package-name
; and then reinstall the apk.

android studio install error [INSTALL_FAILED_INVALID_APK]

I am getting this:
01/20 17:14:40: Launching MyLuaGame $ adb push /Users/name/Desktop/MyLuaGame/frameworks/runtime-src/proj.android-studio/app/build/outputs/apk/MyLuaGame-debug.apk /data/local/tmp/myTest
$ adb shell pm install -r "/data/local/tmp/myTest" Please select on your phone whether can install the app by The ADB command?
pkg: /data/local/tmp/myTest Failure [INSTALL_FAILED_INVALID_APK]
$ adb shell pm uninstall myTest DELETE_FAILED_INTERNAL_ERROR
Error while Installing APK
You have to execute a release apk for installation in device. You can connect your device in android studio and get the debug version app but in order to get an apk to install other devices, you must execute release version apk using a keystore
A common reason for this error is having an app with the same package name already installed but with a different certificate e.g. a store release or a development build from another machine.
Try uninstalling the package with ADB first, using adb uninstall YOUR_PACKAGE_NAME

Categories

Resources