Cordova+android Studio 1.0+ionic+win7

Source: Internet
Author: User

Transfer from http://blog.csdn.net/fuyunww/article/details/42216125

Directory (?) [-]

    1. Execute under Project directory
    2. A Create a project
    3. b Add Platform Support
    4. C Add Plugin in Android Studio 10 can be omitted
    5. D Compile Code
    6. E Run code
    7. Configure Ionic
    8. Porting to Android Studio 10
    9. The project has been completed

1. Preparatory work

· Installing jdk1.6+, setting environment variables

Java_home

C:\Program files\java\jdk1.5.0_07

CLASSPATH

.; %java_home%\lib

Path

%java_home%\bin

· Installing ant, setting environment variables

Ant_home

D:\apache-ant-1.8.2

Path

D:\apache-ant-1.8.2\bin

· Install the Android SDK, set environment variables

Android_home

C:\Program FILES\ANDROID\SDK

Path

%android_home%\tools;%android_home%\platform-tools;%android_home%\build-tools\20.0.0;

· Installing the VS2013 WP8 Simulator

2. Download node. js

http://nodejs.org/download 32-bit or 64-bit version

3. Running node. js Command Prompt

Input configuration PhoneGap

C:\Users\ username > NPM install-gphonegap

PhoneGap saved in c:\users\[user name]\appdata\roaming\npm

4, under the project directory to execute a, create the project
C:\Users\ User name >phonegap create MyApp
C:\Users\ User name \MYAPP>CD MyApp
B. Add platform Support
> Cordova Platforms Add iOS > Cordova platforms add Android > Cordova platforms ls
C, add plugin (can be omitted in Android Studio 1.0)
> Cordova plugin Add org.apache.cordova.device > Cordova plugin Add org.apache.cordova.console > Cordova plugin L S
d, compile the code
> Cordova Build Android
E, run the code
(1) on the simulator
> Cordova emulate Android
(2) on the browser
> Cordova serve Android
Browser access address: Http://localhost:8000/, you can debug the page like debugging the layout of the app. If the Cordova native API call is used in the app, the following dialog box pops up: This is because the browser is unable to provide @javascriptinterface interface, Cordova view through prompt () and native interaction, This is done because of the Android2.3 simulator bug. So debug the page layout, ignore it.
(3) on the real machine
C:\Users\ User name \myapp> Cordova run Android
or C:\Users\ user name \myapp> Cordova Run Wp8/ios

Cordova will automatically establish My-app folder, different platform items under Platforms folder cached content under c:\users\[username]\.cordova\lib

5, Configuration Ionic

1. Open the node. js command Line
2. Enter C:\Users\ user name >npm install-g Cordova Ionic
3. Set up Project input $ionic start myApp tabs
4. If the project has been established, the would will appear. The directory with this new Project?yes
5, run add different platform, if Android, directly replace iOS to Android can.
$ CD MYAPP
$ Ionic Platform Add iOS
Compiling $ ionic Build iOS
Run on simulator $ ionic emulate

Run on the browser $ ionic serve

Run on the real machine $ionic run

6. Porting to Android Studio 1.0

Android Studio 1.0: Because Androidstudio 1.0 is installed by default Android5.0, the compiler version is 21,gradle the current version is 2.2.1, so make some changes to the related files
(1) Modify the selection My-app\platforms\android\build.gradle

Line 10th classpath ' com.android.tools.build:gradle:1.0.+ '
Line 40th Compilesdkversion 21
Line 41st Buildtoolsversion "21.1.1"
Line 74th gradleversion = ' 2.2.1 '

(2) Modify My-app\platforms\android\project.properties

Line 13th target=android-21

(3) Modify My-app\platforms\android\androidmanifest.xml

Line 13th <USES-SDK android:minsdkversion= "ten" android:targetsdkversion= "/>"

(4) Modify My-app\platforms\android\cordovalib\build.gradle

Line 28th Classpath ' com.android.tools.build:gradle:1.0.+ '
Line 35th Compilesdkversion 21
Line 36th Buildtoolsversion "21.1.1"

(5) Modify My-app\platforms\android\cordovalib\project.properties

Line 13th target=android-21

(6) Modify My-app\platforms\android\cordovalib\

Androidmanifest.xml

Line 22nd <USES-SDK android:minsdkversion= "Ten"/>
Located in My-app\platforms\android\build.gradle
Gradle download path for the c:\users\[user name]\.gradle\wrapper\dists, you can download the download tool to the appropriate directory, and create a new content is empty Gradle-2.2.1-all.zip.ok file 8, if the compilation error , prompt for task ' not found in root project ' Android ', then open ANDROID.IML, click "Sync".
The project has been completed

Cordova+android Studio 1.0+ionic+win7 (EXT)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.