Android Studio is not loading on the device, local path doesn't exist

前端 未结 8 1652
余生分开走
余生分开走 2020-12-08 17:20

I recently attempted to migrate my Eclipse project over to Android Studio. All went well until I attempted to run the project and an error came up:

Uploading         


        
相关标签:
8条回答
  • 2020-12-08 17:39

    Please verify if JAVA_HOME is OK.

    https://confluence.atlassian.com/display/DOC/Setting+the+JAVA_HOME+Variable+in+Windows

    It was my problem here and fixed after insert JAVA_HOME i

    0 讨论(0)
  • 2020-12-08 17:42

    I just ran into this problem, even without transferring from Eclipse, and was frustrated because I kept showing no compile or packageDebug errors. Somehow it all fixes itself if you clean and THEN run packageDebug.

    Open up a commandline, and in your project's root directory, run:

    ./gradlew clean packageDebug
    

    Obviously, if either of these steps shows errors, you should fix those...But when they both succeed you should be able to find the apk when you navigate the local path -- and even better, your program should install/run on the device/emulator!

    0 讨论(0)
  • 2020-12-08 17:45

    You can also check your project .iml file to see that the correct APK_PATH is set

    0 讨论(0)
  • 2020-12-08 17:46

    I used these steps:

    1. Close IDE
    2. remove /build folder
    3. Reopen IDE
    0 讨论(0)
  • Go to your project folder. Open ProjectName folder.

    In file Your_Project_name.iml add

    <option name="APK_PATH" value="/build/apk/your_app_name-debug-unaligned.apk" />
    

    Or

    <option name="APK_PATH" value="/build/outputs/apk/your_app_name-debug-unaligned.apk"/>
    

    In new versions of Android studio

    0 讨论(0)
  • 2020-12-08 17:49

    I've encountered this problem after migrating from Eclipse to Android Studio. As shantanu said,

    gradlew packageDebug
    

    helped to point out that I need local.properties file, so I've created it in the project root with just one line, and after that all works fine.
    local.properties contain only one property - sdk.dir, and looks like (in Windows):

    sdk.dir=c:\\path-to-android-studio\\sdk
    

    Don't forget to change \ in your path to \\ (there's no need to escape / in Linux or Mac).

    Wrote this answer only to gather all info about common problem after migrating from Eclipse to Android Studio to help many people get rid of this little trouble faster without googling every step.

    0 讨论(0)
提交回复
热议问题