Yoav Hortman
Yoav Hortman

Reputation: 123

App does not install on android device by an unknown failure

I try installing my app for the first time on a Nexus 5. The android studio then tells me I need to uninstall my app inorder to install it (The app never exsited on the phone) and then asks me to unistall the app, I agree and he tries to unistall but an error occurs:

Waiting for device.
Target device: lge-nexus_5-08a9df88021f8ec8
Uploading file
    local path: D:\USER\Desktop\Yoav\AndroidProject\Example\app\build\outputs\apk\app-debug.apk
    remote path: /data/local/tmp/com.example.user.example
Installing com.example.user.example
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.user.example"
pkg: /data/local/tmp/com.example.user.example
Failure [INSTALL_FAILED_DEXOPT]

At this part the studio asks me to uninstall after pressing ok:

DEVICE SHELL COMMAND: pm uninstall com.example.user.example

Unknown failure

I think it's because the app does not exsit on the phone, but if the app does not exsit why does it even want me to delete it?

Upvotes: 2

Views: 6678

Answers (3)

TanZhenxing
TanZhenxing

Reputation: 179

I had the same problem. I finally had to reboot the device to solve it.

Upvotes: -1

Eugen Pechanec
Eugen Pechanec

Reputation: 38223

It happenes because the .apk you built and are trying to install is missing the classes.dex file. This can happen for various reasons but most of the time (for me) the build process gets stuck somehow.

Open Task Manager and kill all following processes:

cmd.exe
conhost.exe
find_java.exe

Then clean and build your project.

Also make sure you use latest Build tools (now 21.1.1).

Upvotes: 1

It might be because of the package name. Check weather is there any app with the same package name that you created before. com.example is not a good practice to use for you practice projects even.

I may be not right but from the information provided this is what I can say.

Upvotes: 5

Related Questions