Ionic Framework: Exporting Project To APK - android

I have created an app in ionic framework. Now i want generate APK of my code by using Android Studio. But i am getting this error
*"Script 'D:\uvionic\myApp\platforms\android\CordovaLib\cordova.gradle' line: 117
* What went wrong:
A problem occurred evaluating root project 'android'.
Unable to determine Android SDK directory."*
will you please help me where i am wrong. Thanks in advance.

May I ask why you want to export through Android Studio?
Ionic has a guide on building for Android through Ionic CLI, which might be easier than building manually with Android studio.

add your SDK path in system environment PATH variable (change dir according to your installation)
C:/Program Files/android/sdk
let me know if its not working..

Related

phonegap build android => cant find apk with android 7.0.0

I tried to update android in an existing phonegap project, told me fetching 7.0.0 ... completed. when I list platforms, it told me 6.3.0 was installed. So I did
phonegap platform remove android
phonegap platform add android
and copied my jks into platforms/android again.
phonegap build android (--release) is both telling me:
[phonegap] executing 'cordova build android' ...
[phonegap] completed 'cordova build android --no-telemetry'
But I cant find my outputs folder. Neither in platforms/android/build (I only have folder "android-profile" with a json and a rowproto file for every build) nor in platforms/android/app/build (there are folders "intermediate" and "generated"). I already searched for android-release-unsigned.apk and app-release-unigned.apk - nothing found.
Anybody an idea where to search or find out why it isn't created although there are no errors?
Thanks in advance
The answer can be found by adding "-d" to the build command. Then phonegap gives detailed information on build problems. In my case it could not find google-services.json
I faced the same issue and found that the output directory has been changed from ..platforms\android\build to ..\platforms\android\app\build\outputs\apk\debug
You could check the above directory.

Unable to build Android app (created with Ionic framework) after importing the project into Android Studio

I'm a complete beginner at creating mobile apps. I created an Ionic mobile app for Android using Windows and Visual Studio 2017. It works when I use the ionic serve command and try the app in the browser.
But when I try to import the project into Android Studio 2.3.3, I get an error message, that it can't build my app:
"Gradle sync failed: Failed to find target with hash string 'android-26' in: ...\AppData\Local\Android\Sdk
Gradle sync completed.
Gradle build finished with 1 error(s)."
I also get another error message after importing the project into Android Studio, when I try to run the "ionic cordova run android" command in cmd: "An error occured while running cordova run android. FAILURE: Build failed with an exception. Where: ...\cordova.gradle line 64
What went wrong:
A problem occured evaluating root project 'android'. No installed build tools found. Install the Android build tools version 19.1.0 or higher."
I imported the files into Android Studio choosing Import project (Eclipse,...). I chose this folder when importing:
node_modules\cordova-android\spec\fixtures\android_project. I'm not sure this is the right folder to choose.
I can see the simulated android phone , I can click on everything, but my app doesn't show up on it.
I checked the Android build tools, 25.0.3 and 26.0.2 are installed.
Thank you for the help in advance! I'm really stuck :S
You are choosing Wrong Folder.
To open your ionic generated app. You need to open the following folder in the path:
Your_ionic_project/platforms/android
Check whether you have set your system PATH variable pointing to android platform tools.
Something like :
C:\Users\Lokkeshwaran J\AppData\Local\Android\Sdk\platform-tools

Cordova Build for Android Failed - VSTS

I'm trying to build a Cordova Build for android in Visual studio team services.Most of the details are provided in the respective tabs:"android","advanced"(screenshots:).Is there anything else to be filled?
Got an error while building(screenshots:).Can anyone suggest where am i going wrong?
It is due to the wrong path chosen for the cordova working directory.Changed the working directory from "src/mobileApp/******/www" to "src/mobileAp/******". This fixed all issues.

error building android ionic project

I'm trying to build an example project from ionic.
When I run the following the code, I get an error:
ionic build android
I get this error ;
* What went wrong:
Execution failed for task ':compileDebugJava'.
Compilation failed; see the compiler error output for details.
Can someone tell me what to do?
Thanks in advance
Please try the following steps:
ionic platform remove android
ionic platform add android
ionic build android
Have you installed the platform? In this working Mac or Windows? If you add ANDROID_HOME mac ?, If you add windows to your PATH location of the SDK?
Config Android_home osx
Config IONIC Android APP WINDOWS

Android Studio Path (ANDROID-HOME) not able to set?

I am facing the below problem while importing the downloaded project into Andoroid Stuio.
Please help me.
**
Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.7-bin.zip'.
Build file '/Users/Rajesh.K/Desktop/Test/Project/build.gradle' line: 9
A problem occurred evaluating project ':Project'.
A problem occurred evaluating project ':Project'.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Consult IDE log for more details (Help | Show Log)
**
Please help me to come out of this isssue. I am facing this issue in the Android Studio Mac version.
Are you trying to imort studio project into Android studio or eclipse project into Android studio.?
Try to set up your ANDROID_HOME as studio asking you. ( export ANDROID_HOME="PATh to your SDK folder" ) and run studio form this console.
Or you can try to configure in within Android Studio (File->Project Structure->Android SDK) And then you should set the proper SDK path.
I faced something similar but the difference was I had already set the variable into Android Studio and even with that, it was not recognized.
What I did was a simple File -> Invalidade Cache and Restart -> Invalidade and Restart.
I did not go deeper to check if it is a known issue on Android Studio.

Categories

Resources