Android Studio: Always Fails [INSTALL_FAILED_DEXOPT]

I start working with android studio, and I successfully run my application on the emulator,
and sometimes after successful completion and when I want to start my application again,
I get the
Error [INSTALL_FAILED_DEXOPT] error
and ask me to delete my application in the emulator.

After clicking OK, I get an error Unknown Failure

And when I try to start the application again, I get another error.
Error [INSTALL_FAILED_UID_CHANGED]

I can successfully solve my program by rebuilding the project and manually deleting the package in / data / data and / data / local / tmp.
But the problem exists again and again after several starts.
What should I do to stop this problem as it makes my debugging very difficult.

Here is the error message I get:

Waiting for device.
Target device: Nexus_4_API_19 [emulator-5554]
Uploading file
    local path: C:\Users\brian_000\AndroidStudioProjects\MyApplication\app\build\outputs\apk\app-debug.apk
    remote path: /data/local/tmp/com.example.brian.myapp
Installing com.example.brian.myapp
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.brian.myapp"
pkg: /data/local/tmp/com.example.brian.myapp
Failure [INSTALL_FAILED_DEXOPT]


DEVICE SHELL COMMAND: pm uninstall com.example.brian.myapp
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.brian.myapp"
pkg: /data/local/tmp/com.example.brian.myapp
Failure [INSTALL_FAILED_DEXOPT]


DEVICE SHELL COMMAND: pm uninstall com.example.brian.myapp
Unknown failure
+4
source share
4 answers

I ran into the same problem with Android SDK tools version 24.0.2, it seems like a problem with tools version 24.0.2.

If you use the same, you can try the solution mentioned below, which solved my problem.

Download SDK r23 from here

https://dl.google.com/android/android-sdk_r23.0.2-windows.zip

, SDK sdk, Google, .

Android Studio SDK " " .

.

adb insted Android, .

+2

, , . , .

+1

, SDK toole 24.0.2, , SDK- 22.0.1. , .

0

I had the same problem, I fixed it by cleaning the project and cleaning the build folder inside the application folder, then restarted the device and the problem disappeared,

you can also patch and change the application id

android {
    compileSdkVersion Integer.valueOf(COMPILE_SDK_VERSION)
    buildToolsVersion String.valueOf(BUILD_TOOLS_VERSION)
    defaultConfig {
        applicationId "your application ID"
        versionName = VERSION_NAME
        versionCode = Integer.valueOf(VERSION_CODE)
        minSdkVersion  Integer.valueOf(MINIMUM_SDK)
        targetSdkVersion  Integer.valueOf(COMPILE_SDK_VERSION)
    }

hope this helps.

0
source

Source: https://habr.com/ru/post/1569831/


All Articles