Reputation: 301
I'm hitting a snag in getting the MyFirstApp (Hello World) Android app to work in the emulator.
I am following the instructions at:
http://developer.android.com/training/basics/firstapp/running-app.html
Windows7-64 / Eclipse
The app works via USB to my phone.
Steps taken:
Make sure my PATH environment variable includes the Android SDK. OK.
Launch C:/Users/(me)/AppData/Local/Androd/android-sdk/platform-tools/adb.exe. OK.
Start the emulator from Eclipse. OK, it comes up.
Verify that MyFirstApp.apk is present in the Eclipse workspace MyFirstApp/bin directory.
Run the MyFirstApp application from Eclipse.
The Eclipse console prints out:
[2012-12-01 23:02:15 - MyFirstApp] Android Launch!
[2012-12-01 23:02:15 - MyFirstApp] adb is running normally.
[2012-12-01 23:02:15 - MyFirstApp] Performing com.example.myfirstapp.MainActivity activity launch
[2012-12-01 23:02:15 - MyFirstApp] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Galaxy_Captivate_2.2'
[2012-12-01 23:02:15 - MyFirstApp] Uploading MyFirstApp.apk onto device 'emulator-5554'
[2012-12-01 23:02:17 - MyFirstApp] Failed to install MyFirstApp.apk on device 'emulator-5554': No such file or directory [!! RED (error) !!]
[2012-12-01 23:02:17 - MyFirstApp] com.android.ddmlib.SyncException: No such file or directory [!! RED (error) !!]
[2012-12-01 23:02:17 - MyFirstApp] Launch canceled! [!! RED (error) !!]
I tried adb install from a command line:
adb install MyFirstApp.apk
and got
failed to copy 'MyFirstApp.apk' to '/data/local/tmp/MyFirstApp.apk': No such file or directory
rm failed for /data/local/tmp/MyFirstApp.apk, No such file or directory
I have not seen this problem reported anywhere else after hours of searching.
If I run
adb shell
I can see the /data directory. It appears empty but the permissions are drwxrwx--x, which would account for my not being able to see any contents.
So it seems that for some reason the .apk file is not getting copied to the emulator.
One other suspicious thing: If I run
adb logcat
then this prints out a list of complaints including,
E/dalvikvm( 3520): Can't open dex cache '/data/dalvik-cache/system@[email protected]@classes.dex': No such file or directory
...
W/dalvikvm( 3620): JNI_CreateJavaVM failed.
Any help would be much appreciated.
Android SDK Tools Rev 21
Android SDK Platform-tools Rev 16
Android 2.2 (API 8)
SDK Platform Rev 3
Upvotes: 4
Views: 38888
Reputation: 1
adb shell rm -rR -f /data/local/tmp
And then
mkdir /data/local/tmp
chmod 777 /data/local/tmp
try
adb install again
of course, you can choose the other permission mode
Upvotes: 0
Reputation: 101
I also had the same problem. You can try: First, you can push the apk package to sdcard: adb push test.apk /sdcard/
then, install apk from sdcard: adb shell pm install /sdcard/test.apk
Hope that can help you!
Upvotes: 2
Reputation: 48
I got that same error today when trying to install onto an emulated device. It turned out to have no available space, which is why the APK file could not be found (because the push failed but for some reason adb didn't know that and provide an informative error).
It's possible that by creating a new AVD this problem would be "disappear".
Upvotes: 0
Reputation: 171
I had the same problem. The reason was in bad apk file :). It was damaged.
Just, try to check it.
Upvotes: 0
Reputation: 301
Thank you Luis for your suggestion.
Indeed, the emulator had not started properly. It was stuck in the black "A N D R O I D screen of death". I learned that the emulator has not fully started until it shows a screen like a normal Android phone.
The directory name was not the problem, I was already using the default C:/Users/... directory, not C:/Program Files.
However, today it works. I am not entirely certain why it works today and not previously. Here's what I did:
Installed the latest versions of Android SDK Tools and Android SDK Platform Tools from the SDK Manager. There's a new version since my first attempt in December 2012.
Deleted the directory, C:/Users/[my-username]/.android/avd
(from Eclipse) created a new AVD using the default values for Memory Options and internal storage.
Launched the emulator from Android Virtual Device Manager via Eclipse. It is helpful to have the LogCat view open in Eclipse to see a typeout of progress as the emulator kicks in.
Upvotes: 2
Reputation: 12058
The data
directory should have about 20 directories in it, even before you install your app. So, if you find it empty, it's not a problem with your app, but a problem with emulator or sdk instalation.
A commom problem that results in strange behaviors comes from using spaces
in the directory name where SDK
is installed.
Try choosing in Eclipe the menu Window
, Prefrences
, Android
and in SDK Location
instead of:
C:\Program Files (x86)\Android\android-sdk
type (in 32 bits machine):
C:\Progr~1\Android\android-sdk
or (in 64 bits machine)
C:\Progr~2\Android\android-sdk
If this doesn't solves your issue, I suggest to re-install ADT and SDK.
Regards.
Upvotes: 0