141

After updating Android Studio to 0.2.4 I can't get my project to deploy. There is a complete mismatch of the apk filename.

Waiting for device.
Target device: 0146B0020E010020
Uploading file
    local path: /home/martin/workspace/git/projectname/projectname/project/build/classes/debug/AppName.apk
    remote path: /data/local/tmp/com.xxx.xxx.android.projectname
Local path doesn't exist.

After reading some posts here, I changed the output path to the build/apk folder, but the issue remains. Instead of the created projectname-debug-unaligned.apk he is looking for the projectname.apk and I have no idea how and where I can tell him to change the name he is looking for. Any ideas?

PS: Yes I have read several posts which are shown in the list on the right side. The restart of the IDE worked for my coworker, but not for me.

Edit:

I stumbled from one issue to the next so I reverted back to the only downloadable version I could find: 0.2.0.

No disappearing UI elements, I can create new projects and, best of all, I can finally deploy the APK from the studio to my device again. I will try 0.2.5 as soon as it is released.

Roman C
  • 49,761
  • 33
  • 66
  • 176
WarrenFaith
  • 57,492
  • 25
  • 134
  • 150
  • I tried with 0.2.5 and it is not fixed... Have you found another solution ? – Rémi F Aug 18 '13 at 11:07
  • it fixed it for me. I switched a lot between different projects and also created a new one and it started to work... Not sure how all this seems to be connected... – WarrenFaith Aug 19 '13 at 10:19
  • 5
    A simple solution for me was to add in my module iml file (in fact configuration). I also solved the issue using Victor's answer (clean all and re-import the project) – Rémi F Aug 19 '13 at 19:24
  • possible duplicate of [android studio not loading on device, local path doesn't exist](http://stackoverflow.com/questions/16994596/android-studio-not-loading-on-device-local-path-doesnt-exist) – childno͡.de Aug 21 '13 at 08:38
  • 0.2.10 still has this issue – Valerio Santinelli Sep 26 '13 at 21:32
  • This started to happen to me under 2.0.13 on the Mac. Adding the APK_PATH fixed it for me. – Kevin Oct 14 '13 at 17:49

28 Answers28

273

I originally saw this error after upgrading from 0.2.13 to 0.3. These instructions have been updated for the release of Android Studio 0.5.2. These are the steps I completed to resolve the issue.

1.In build.gradle make sure gradle is set to 0.9.0

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.0'
    }
}

2.In gradle-wrapper.properties make sure to use gradle 1.11

#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip

3.Sync project with gradle files by pressing the button to the left of the avd button

enter image description here

4.Try to build project again. If still having issues possibly try File > Invalidate Caches/Restart

NOTE: If you are using 0.9.+ and it gives Could not GET 'http://repo1.maven.org/maven2/com/android/tools/build/gradle/'. Received status code 401 from server: Unauthorized (happens sporadically) then change to 0.9.0. Also, you have to use build tools 19.0 or greater I believe so make sure you have those downloaded in sdk manager and use as buildToolsVersion in whichever gradle file holds that info.

Adam Johns
  • 35,397
  • 25
  • 123
  • 176
  • 9
    +1 Excellent answer. I might add that you need to update build.gradle for all of your libraries too. And also, after all that, if you still have issues to shutdown android studio and reopen. – ingh.am Oct 21 '13 at 15:14
  • 1
    Just bumping the build tools (or is that itself Gradle? Impossible to know without devoting more of my life to the tediums of YET ANOTHER build system) to 0.6 fixed this problem for me. – nmr Oct 21 '13 at 20:20
  • Yeah, if you are already using 1.8, just step number 1 should solve the problem. I was still on 1.6 and it told me I had to use 1.8 if I was going to use gradle:0.6.+ in build.gradle – Adam Johns Oct 21 '13 at 20:41
  • 1
    This issue occured when upgrading to 0.3 indeed. Perfect answer. – mmvie Nov 04 '13 at 08:42
  • 3
    Works like a charm. I needed to follow step 4. to get it working. – r4m Nov 04 '13 at 13:25
  • Doesn't seem to work in the latest version, but refreshing Gradle tasks does help. View > Tool Windows > Gradle, then 'Refresh all Gradle projects' – Dov D. Dec 05 '13 at 17:28
  • If you are like me and couldn't find the button in step three you can choose Tools -> Android -> Sync Project with Gradle Files instead – Angus Cheng Dec 22 '13 at 10:49
  • If you're running an older version of Android Studio you'll need to upgrade so that the versions are compatible: Android Studio -> Check for Updates... – merrick Feb 23 '14 at 01:54
  • this is not a exact solution for 0.8.6 version – Zafer Celaloglu Aug 19 '14 at 08:16
  • still error existing for gradle 1.2.3 and android studio 1.3.please help me – RamBabu Pudari Jun 30 '15 at 09:32
37

Try this:

  1. Close IDE
  2. Remove .idea folder and all .iml files in the project.
  3. Restart the IDE and re-import the project.

Original post: https://code.google.com/p/android/issues/detail?id=59018

Victor Yanez
  • 544
  • 4
  • 7
26

I managed to find a temporary workaround. Do all by yourself using command line :

// build apk
./gradlew assemble --daemon

// debug apk is unaligned so we need to align it
zipalign -f 4 app/build/apk/app-debug-unaligned.apk app/build/apk/app-debug.apk

// reinstall it using adb
adb install -r app/build/apk/app-debug.apk

This is temporary, but I hope they will fix this for 0.2.5

Edit : not fixed in 0.2.5

Edit2 : fixed for now by adding in my module.iml file (in facet/configuration) :

<option name="APK_PATH" value="/build/apk/appname-debug-unaligned.apk" />
Rémi F
  • 1,327
  • 12
  • 25
14

Restart Android Studio (0.3.0) worked for me.

Usman Nisar
  • 3,031
  • 33
  • 41
14

I fixed this by adding "Gradle-aware make" before launch in my launch configuration.

enter image description here

Elyess Abouda
  • 659
  • 12
  • 20
9

From 0.2.13 to 0.3.0 Just download new gradle 1.8 from http://www.gradle.org/downloads Reimport project and choose new gradle to use.

in build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.1'
    }
}

not sure it really need, but i use invalidate caches and restart before reimport project invalidate caches and restart

Community
  • 1
  • 1
Evgeniy S
  • 1,464
  • 12
  • 32
6

Heh tried all these answers and none of them worked. I think a common cause of this issue is something a lot simpler.

I advise all who get this problem to look at their launch configuration:

Launch Configuration

Look! The launch configuration contains options for which APK to deploy. If you choose default, Android Studio will be dumb to any product flavors, build types etc. you have in your gradle file. In my case, I have multiple build types and product flavors, and received "no local path" when trying to launch a non-default product flavor.

Android Studio was not wrong! It couldn't find the default APK, because I was not building for it. I solve my issue by instead choosing "Do not deploy anything" and then executing the gradle install task I needed for my specific combination of product flavor / build type.

stevebot
  • 23,275
  • 29
  • 119
  • 181
5

like wrote here:

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. Don't worry about the deprecated method statement - it seems to be a generic notice to developers.

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 now be able to find the apk when you navigate the local path -- and even better, your program should install/run on the device/emulator!

Community
  • 1
  • 1
ofir_aghai
  • 3,017
  • 1
  • 37
  • 43
3

I just managed to fix this. I followed Adams instructions but it still would not work so I kept digging and did this on top of Adams instructions:

I went to Module Settings and in the Paths tab under Compiler output I selected Inherit project compile output path. I am running 0.3.0

Dan Pena
  • 87
  • 5
2

Just Close The Android Studio and Restart it and Sysnc. Gradle Files Again......And Run The Project Again

2

I had to re-import my project. I also made sure to update the gradle dependency in my build.gradle file. In the case of Android Studio 0.3 this was 0.6.+. That seemed to do the trick.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'
    }
}
pqvst
  • 4,344
  • 6
  • 33
  • 42
2

Have you tried Build -> Rebuild project?

Alessandro Roaro
  • 4,665
  • 6
  • 29
  • 48
2

In case you hit this issue after an upgrade to studio 0.3.4do a rm android-studio/plugins/gradle/lib/gradle-*-1.8.jar. There is a 1.9-rc-2 release of gradle available there. Make sure your gradle path is set to automatic. If set manually change to automatic or manually point it to the latest gradle release.

Also make sure you run ./gradlew clean packageDebug in your project root.

Ref

Pratik Mandrekar
  • 9,362
  • 4
  • 45
  • 65
1

delete de out directory and .ide folder work for me

1

I got this after upgrading to 0.2.7 from 0.2.5. Deleted all *.iml, .idea folders and restart IDE then re-import settings.gradle worked for me

user1726190
  • 51
  • 1
  • 3
1

The best way to you fix this problem.

http://www.youtube.com/watch?v=i4WcMIyc8OQ

Good Luck =D

Lucas Pugliese
  • 569
  • 1
  • 6
  • 12
1

If you have run into this problem while updating to android studio version 0.3.3 or 0.3.4 then you need to remove gradle 1.8 jars from android-studio/plugins/gradle/lib

rm android-studio/plugins/gradle/lib/gradle-*-1.8.jar 
bugraoral
  • 2,630
  • 1
  • 21
  • 25
1

When I look at my file system I see that the apk is generated but in a different folder and with a different name.

However, this is not where it needs to be. After some time I gound that there is an option in the “.iml” file that you can configure to fix it.

There are multiple “.iml” files, one for the master project, one for the module that contains that produces the apk. If you edit the “.iml” file for the module and add the following option with path respective to your project

<option name="APK_PATH" value="/build/apk/desiredname-debug-unaligned.apk" />
Noah
  • 15,080
  • 13
  • 104
  • 148
1

For those who still can't solve this issue after following all the answers on here. Look in the Gradle console. I had build errors that for some reason were only showing on the Gradle console. Once I fixed them, I could run the app.

Daniel Ryan
  • 6,976
  • 5
  • 45
  • 62
1

For me uninstalling the app from the device works. :)

dmSherazi
  • 3,743
  • 5
  • 37
  • 62
0

If your project is not a Gradle project,

And you got this "local path doesn't exist" error after updating Android Studio to 0.9.2+ version

You should open the .iml file of the project and remove this:

<facet type="android-gradle" name="Android-Gradle">
  <configuration>
    <option name="GRADLE_PROJECT_PATH" />
  </configuration>
</facet>

It solved the problem for me.

David
  • 37,109
  • 32
  • 120
  • 141
0

I solved this problem by stopping the gradle deamon by typing ./gradlew -stop into the terminal

Yoraco Gonzales
  • 727
  • 10
  • 18
0

Restart the IDE. I restarted Android Studio. The error went away.

OrangeTree
  • 618
  • 5
  • 21
0

Recently I had the same issue and none of the above mentioned solutions worked for me.

What caused the issue: My Android project was running fine without any issue. After I updated my Android Studio to 1.2 Beta the "Local path doesn't exist" error was showing when I tried to run on device.

This is what worked for me:

  1. gradle-wrapper.properties distributionUrl=https://services.gradle.org/distributions/gradle-2.3-all.zip
  2. build.gradle

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.1.3'
        }
    }
    

The latest stable version of gradle build tool is 1.1.3 http://jcenter.bintray.com/com/android/tools/build/gradle/

Adnan
  • 2,001
  • 2
  • 26
  • 28
0

Synchronize the project and all will done in version 1.1.0

dharmendra
  • 7,835
  • 5
  • 38
  • 71
0

This is how I solved it For Android Studio 1.0.1:

In application's main build.gradle file make sure gradle version is atleast 1.1.0 like this:

classpath 'com.android.tools.build:gradle:1.1.0'

and the repositories section contains mavenCentral() instead of jCentral()

Asif Mujteba
  • 4,596
  • 2
  • 22
  • 38
0

Please check the build.gradle file. if there is some operation about "applicationVariants.all" or the assignment to output.outputFile, means trying to change to name or location of the output file.

You can try to comment them out first then try again.

Zephyr
  • 6,123
  • 34
  • 33
0

In my case the problem was only that a folder in the project path contains non-English (Arabic) characters

Mohamed Ali
  • 3,717
  • 1
  • 33
  • 39