Ionic build android - FAILS


#1

F:\DROPBOX\ionic\myApp>ionic build android
Running command: “C:\Program Files\nodejs\node.exe” F:\DROPBOX\ionic\myApp\hooks
\after_prepare\010_add_platform_class.js F:\DROPBOX\ionic\myApp
add to body class: platform-android
ANDROID_HOME=C:\Users\SonyDaman\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_71
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:compileDebugAidl
:CordovaLib:generateDebugBuildConfig
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets
:CordovaLib:processDebugManifest
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:compileDebugJavaWithJavacF:\DROPBOX\ionic\myApp\platforms\android\Co
rdovaLib\src\org\apache\cordova\CordovaInterfaceImpl.java:217: error: cannot fin
d symbol
getActivity().requestPermissions(permissions, requestCode);
^
symbol: method requestPermissions(String[],int)
location: class Activity
F:\DROPBOX\ionic\myApp\platforms\android\CordovaLib\src\org\apache\cordova\Cordo
vaInterfaceImpl.java:223: error: cannot find symbol
getActivity().requestPermissions(permissions, requestCode);
^
symbol: method requestPermissions(String[],int)
location: class Activity
F:\DROPBOX\ionic\myApp\platforms\android\CordovaLib\src\org\apache\cordova\Cordo
vaInterfaceImpl.java:228: error: cannot find symbol
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
^
symbol: variable M
location: class VERSION_CODES
F:\DROPBOX\ionic\myApp\platforms\android\CordovaLib\src\org\apache\cordova\Cordo
vaInterfaceImpl.java:230: error: cannot find symbol
int result = activity.checkSelfPermission(permission);
^
symbol: method checkSelfPermission(String)
location: variable activity of type Activity
F:\DROPBOX\ionic\myApp\platforms\android\CordovaLib\src\org\apache\cordova\Cordo
vaActivity.java:493: error: method does not override or implement a method from
a supertype
@Override
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors
FAILED

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ‘:CordovaLib:compileDebugJavaWithJavac’.
Compilation failed; see the compiler error output for details.
BUILD FAILED

Total time: 9.639 secs

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
ERROR building one of the platforms: Error code 1 for command: cmd with args: /s
,/c,"F:\DROPBOX\ionic\myApp\platforms\android\gradlew cdvBuildDebug -b F:\DROPBO
X\ionic\myApp\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.
useDeprecatedNdk=true"
You may not have the required environment or OS to build this project
Error: Error code 1 for command: cmd with args: /s,/c,"F:\DROPBOX\ionic\myApp\pl
atforms\android\gradlew cdvBuildDebug -b F:\DROPBOX\ionic\myApp\platforms\androi
d\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
F:\DROPBOX\ionic\myApp>


#2

Try to update your android SDK


#3

Always the first thing to do (simplest and has very small footprint): what permissions are you using? If mac, use sudo to chmod and chown. If windows, run your command shell as administrator.


#4

Make sure the SKD platform for the version of Android you’re building is installed.


#5

Thanks guys problem is OS default language.

:heart_eyes::heart_eyes::heart_eyes::heart_eyes::heart_eyes:

I am using Windows8 and i changed it English to Hindi .Thats why i am also unable to update android SDK.
Once i changed it from Hindi to English .
Everything is fine now i created 5 app thanks once again to to watch it.

:slightly_smiling: :slightly_smiling: :slightly_smiling: :slightly_smiling:


#6

Hey I’m having the exact same problem and I’m not getting a way to ressolve it. My sdks are all installed and my minium sdk version for the phonegap-facebook-plugin is
My CordovaLib is
and my android app min sdk is 14 too.
I’m really lost here and it all happened after I followed this tutorial: http://ngcordova.com/docs/plugins/facebook/


#7

!'m have same problem.

My steps for solver, more, still unresolved… :frowning:

set ANDROID_HOME and JAVA_HOME(JDK7)

upgrade cordova platform android
cordova platform remove android
cordova platform add android
cordova -d plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="MY_CODE_APP_IP" --variable APP_NAME="name_app"
android update project --subprojects --path "platforms/android" --target android-21 --library "CordovaLib"
android update project --subprojects --path "platforms/android" --target android-21 --library "phonegap-facebook-plugin/project-FacebookLib"

cd platforms/android

update file:
C:\Users\MyUser\workspace\project\platforms\android\phonegap-facebook-plugin\project-FacebookLib\project.properties
add:
sdk.dir=C:/Users/MyUser/AppData/Local/Android/sdk

ant clean
cd phonegap-facebook-plugin\project-FacebookLib
ant clean

update file:
AndroidManifest.xml with: <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />

mkdir ant-build
ant release

In root project: ionic build android

Fail Build in CordovaInterfaceImpl.java:222
android\CordovaLib\src\org\apache\cordova\CordovaInterfaceImpl.java:222: Error: cannot find symbol getActivity().requestPermissions(permissions, requestCode);
...
What went wrong:
Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.

My info about system:

Cordova CLI: 6.1.1
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.1
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Windows 8.1
Node Version: v4.4.3

#8

I downgraded my min sdk version to 14,
Downloaded, and made sure it was installed, all the sdks i needed
AND and this is importante, beware of all the special characters in file names, folders and etc. What was fucking me up was a file name.
Same happened in iOS, my project has a special character in its config name “andá” and my .xcodeproj was going out like andá.xcodeproj and it was fucking my project up.
And this compile debug thing it was exactly what was happening to me with the file names.

One thing you need to be sure is to install the facebook plugin in your android platform. I know you ded I just wasnt sure you added the project id to that lines and the project name, like: cordova -d plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID=d1d212esadegt42y45 --variable APP_NAME=bullsApp


#9

man, my project use one name simple lowercase, basic…
i’m today go made one simple project ionic and rebuild its sequency for isolate problems of dependences. Recompiled in JDK 6 and sdk other version for example.

I inform my progress if improve the scenario.


#10

Im going to try on windows 10 and give you what happen!


#11

I am getting the same problem. Please help me to solve