简体   繁体   中英

How to generate APK file from Android Hybrid?

When I run this command cordova build android --release this gives me an error like:

Current working directory is not a Cordova-based project.

How can I generate an APK file?

The application is built using Hybrid (PhoneGap and Android)

As I can see from the image, that you are running the command from Platform specific (Android) directory. See the image below of the directories the phonegap creates. The project directory is different. You need to run the build command from the Project Directory .
The sample project in the image is pgdatabase1 .
NB The below directories are for phonegap 3.4.x在此处输入图片说明

Edit1: My guess is that the project has not been created using the command line tool (CLI). It has been created directly in Eclipse. The apk file is present in the MDLiveMobileAndroid\\bin directory.
Take a backup of the APK file before following the below steps.
1.Launch the Eclipse application.
2.Select the New Project menu item.
2.Choose Android Project from Existing Code from the resulting dialog box, from the android folder and press Next:
4.select the MDLiveMobileAndroid directory then click “Next”.
Select the projects that show there and click “Next”.
This should import the project's into eclipse
5.Press Finish.

Once the Eclipse window opens, a red X may appear to indicate unresolved problems. If so, follow these additional steps:
1.Right-click on the project directory.
2.In the resulting Properties dialog, select Android from the navigation pane.
3.For the project build target, select the highest Android API level you have installed.
4.Click OK.
5.Select Clean from the Project menu.

This should hopefully correct all the errors in the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM