ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

platforrms/android not added after adding crosswalk, ionic run android fails

Open arunr opened this issue 11 years ago • 27 comments

I did the following:

  1. ionic start my_app
  2. cd my_app
  3. ionic browser add crosswalk

I see the following after that:

Adding crosswalk browser Downloaded cordova-crosswalk-engine Downloaded Cordova Android for Crosswalk Downloading: https://download.01.org/crosswalk/releases/crosswalk/android/stable/8.37.189.14/arm/crosswalk-webview-8.37.189.14-arm.zip Downloading: https://download.01.org/crosswalk/releases/crosswalk/android/stable/8.37.189.14/x86/crosswalk-webview-8.37.189.14-x86.zip [=============================] 100% 0.0s [=============================] 100% 0.0s Downloaded Crosswalk webviews Fetching Android SDK API 19.1.0 Downloaded Android runtime (API 19) Removed old Cordova Android platform Added Cordova Android 4.0 Added Crosswalk Webview Engine Ionic Browser Add completed for Crosswalk

  1. After this when I do ionic run android, I see: No platforms added to this project. Please use cordova platform add <platform>.

Am I expected to manually add the android platform?

arunr avatar Jan 14 '15 11:01 arunr

Also, if I do go ahead and add android platform, I am not sure that crosswalk is getting packaged when I run the app (I verified this because the size of the output apk is the same as without crosswalk).

arunr avatar Jan 14 '15 11:01 arunr

@arunr - the ionic browser add crosswalk should take care of everything for you. You should not have to manually add the android version.

I think what is happening here is an error perhaps and not reporting it?

First, go ahead and run ionic info and copy/paste that info here so I can see what your runtime is.

Second, if you list the contents after the command has finished, is there nothing inside the platforms/android folder?

jbavari avatar Jan 14 '15 17:01 jbavari

Hi,

I am also getting this type of error with below message.

FAILURE: Build failed with an exception.

  • Where: Script '/Users/mahabahubehera/kross/platforms/android/cordova.gradle' line: 52

  • What went wrong: A problem occurred evaluating script.

    No usable Android build tools found. Highest installed version is 19.0.3; minimum version required is 19.1.0.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.335 secs

/Users/mahabahubehera/kross/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: /Users/mahabahubehera/kross/platforms/android/gradlew with args: assembleDebug,-b,/Users/mahabahubehera/kross/platforms/android/build.gradle,-Dorg.gradle.daemon=true Error: /Users/mahabahubehera/kross/platforms/android/cordova/run: Command failed with exit code 8 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:756:16) at Process.ChildProcess._handle.onexit (child_process.js:823:5)

mahabahu avatar Jan 14 '15 17:01 mahabahu

@mahabahu - please run android in your command line, locate and install the `Android SDK Build-tools 19.1.0

Hopefully that will fix the issue.

jbavari avatar Jan 14 '15 17:01 jbavari

@jbavari - While installing the SDK 19.1 i am getting following error Downloading Android SDK Build-tools, revision 19.1 Failed to create directory /usr/local/Cellar/android-sdk/22.6.2/temp

mahabahu avatar Jan 14 '15 19:01 mahabahu

Are you installing the android tools with brew?

jbavari avatar Jan 14 '15 19:01 jbavari

@mahabahu - after doing a little research, it looks like your issue is more with the sdk not updating due to some permission or other file related errors.

I'd start researching on how to update the sdk without the errors you're having, as well trying sudo android to see if that helps by running it with higher permissions.

jbavari avatar Jan 14 '15 19:01 jbavari

if you are running on windows try to turn off UAC, It helped me now.

Fayozjon avatar Jan 14 '15 23:01 Fayozjon

@jbavari thanks for your help! When I run ionic info, I see this:

OS: Mac OS X Yosemite Node Version: v0.10.28 Cordova CLI: 3.5.0-0.2.4 Ionic Version: 1.0.0-beta.11 Ionic CLI Version: 1.3.1 Xcode version: Xcode 6.1.1 Build version 6A2008a ios-sim version: 1.9.0

Also, after running ionic browser add crosswalk, my platforms/ directory is empty - no android inside that directory.

arunr avatar Jan 15 '15 01:01 arunr

@jbavari: I have tried with sudo android but with no success. Though i have already installed android studio and it has a sdk manager with updated build tool 22.1.0. But while running the android command it opens another instance of SDK manager in a different path as i mentioned above.

mahabahu avatar Jan 15 '15 04:01 mahabahu

Im having this problem too. ionic browser add [email protected] runs successfully, but then ionic run android yields this error:

The provided path "/Users/collin/Projects/ionicapp/platforms/android" is not an Android project.
$ ionic info

Your system information:

OS: Mac OS X Yosemite
Node Version: v0.10.35
Cordova CLI: 3.5.0-0.2.4
Ionic Version: 1.0.0-beta.14
Ionic CLI Version: 1.3.2
Xcode version: Xcode 6.1.1 Build version 6A2008a 
ios-sim version: 3.1.1 

colllin avatar Jan 15 '15 06:01 colllin

I think I got it working! I'm not sure what fixed it - I think the main thing was reloading my terminal. But I also updated npm to the latest version. The first thing that started working -- after ionic browser add crosswalk and then failing to run ionic run android -- running ionic platform android started giving me an error that the engine.crosswalk plugin required cordova-android version >= 4.0.0-dev. Once I upgraded cordova to the latest (v4.2) (npm update -g cordova), ionic run android seems to be building an app!

colllin avatar Jan 15 '15 06:01 colllin

@colllin this worked for me too... thanks so much! (* upgrade cordova, and re-launch my terminal). Now I need to figure out how to get the plugins working!

arunr avatar Jan 15 '15 11:01 arunr

I'm not sure this should be closed yet... At the very least it should detect the issue and print out instructions for how to fix it. Better if it can just fix the problem for you.

colllin avatar Jan 15 '15 15:01 colllin

@colllin, agree, re-opening it.

arunr avatar Jan 18 '15 03:01 arunr

Hi collin (@collin), I followed all the suggestions you made above but I still get the error below when I run $ ionic run android

Running command: /Users/drsedusa/Desktop/temp/my_app/hooks/after_prepare/010_add_platform_class.js /Users/drsedusa/Desktop/temp/my_app
add to body class: platform-android
Running command: /Users/drsedusa/Desktop/temp/my_app/platforms/android/cordova/run 
WARNING : No target specified, deploying to emulator
WARNING : no emulator specified, defaulting to AVD_for_s4

I can't seem to figure out why I get the WARNING: No target specified error message even though my platforms/android folder seems complete.

screen shot 2015-01-20 at 11 53 54 am

Below is a copy of my system info.

$ ionic info

Your system information:

OS: Mac OS X Yosemite
Node Version: v0.10.30
Cordova CLI: 4.2.0
Ionic CLI Version: 1.3.2
Xcode version: Xcode 6.1.1 Build version 6A2008a 
ios-sim version: 3.0.0 

I'd really appreciate the help figuring out what's going on. Thanks!!

sedusa avatar Jan 20 '15 17:01 sedusa

Looks like you don't have a device connected via usb, and also don't have an emulator installed? so ionic run android has nothing to run on? Try just ionic build android, or try connecting your device?

On Tuesday, January 20, 2015, sedusa [email protected] wrote:

Hi collin (@collin https://github.com/collin), I followed all the suggestions you made above but I still get the error below when I run $ ionic run android

Running command: /Users/drsedusa/Desktop/temp/my_app/hooks/after_prepare/010_add_platform_class.js /Users/drsedusa/Desktop/temp/my_app add to body class: platform-android Running command: /Users/drsedusa/Desktop/temp/my_app/platforms/android/cordova/run WARNING : No target specified, deploying to emulator WARNING : no emulator specified, defaulting to AVD_for_s4

I can't seem to figure out why I get the WARNING: No target specified error message even though my platforms/android folder seems complete.

[image: screen shot 2015-01-20 at 11 53 54 am] https://cloud.githubusercontent.com/assets/5447546/5821571/1ffd6556-a09b-11e4-9cf1-9c31c4893d29.png

Below is a copy of my system info.

$ ionic info

Your system information:

OS: Mac OS X Yosemite Node Version: v0.10.30 Cordova CLI: 4.2.0 Ionic CLI Version: 1.3.2 Xcode version: Xcode 6.1.1 Build version 6A2008a ios-sim version: 3.0.0

I'd really appreciate the help figuring out what's going on. Thanks!!

— Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic-cli/issues/179#issuecomment-70690197.

colllin avatar Jan 21 '15 20:01 colllin

@colllin thanks a lot. @jbavari helped clear up the confusion I was having about the workings of Crosswalk yesterday (issue #197). Everything's working fine now.

sedusa avatar Jan 21 '15 20:01 sedusa

@colllin - Just seeking some concept clarification here, do you recommend we post a message asking the user to upgrade cordova (npm install -g cordova) or just run this command for them?

jbavari avatar Jan 21 '15 20:01 jbavari

@jbavari I can't be certain that was the issue. I don't want to waste anyone's time, so if we don't know what the issue was, I guess there is no issue. But we both definitely had trouble following the instructions in the blog post. Might be the case that all that was needed was reloading the terminal? Can you detect the error and send them to this issue to provide more information / a list of things to try? This was supposed to be a magical function of the cli (using crosswalk), but in fact took up 2 nights of frustrated debugging in circles.

On Wednesday, January 21, 2015, Josh Bavari [email protected] wrote:

@colllin https://github.com/colllin - Just seeking some concept clarification here, do you recommend we post a message asking the user to upgrade cordova (npm install -g cordova) or just run this command for them?

— Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic-cli/issues/179#issuecomment-70917101.

colllin avatar Jan 21 '15 21:01 colllin