Android platform issues


#1

I added android platform to my application and by default it adds android 7.0.0… When i run this application on a device that has android 6 Marshmellow… It stucks at splash screen and gives the following error in the console:

Uncaught syntax: Unexpected token )  vendor.js:117360
Uncaught syntax: missing ) after argument list   main.js:8156

So i tried to add android 6.0.0 as platform by the following command:

ionic cordova platform add android@6.0.0 

i have also tried this if it makes any difference:

ionic cordova platform add android@~6.0.0

both time i got the errors:

ANDROID_HOME=/Users/faizan/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
Failed to install 'cordova-plugin-device': CordovaError: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: /Users/faizan/Library/Android/sdk/tools/templates/gradle/wrapper
    at Object.module.exports.check_gradle (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/lib/check_reqs.js:90:25)
    at GradleBuilder.prepEnv (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/lib/builders/GradleBuilder.js:161:23)
    at Api.module.exports.runClean (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/lib/build.js:131:20)
    at /Users/faizan/Documents/Angus-mobile/platforms/android/cordova/Api.js:391:50
    at _fulfilled (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:796:13)
    at /Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:604:44
    at runSingle (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:137:13)
    at flush (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:125:13)

(node:2496) UnhandledPromiseRejectionWarning: CordovaError: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: /Users/faizan/Library/Android/sdk/tools/templates/gradle/wrapper
    at Object.module.exports.check_gradle (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/lib/check_reqs.js:90:25)
    at GradleBuilder.prepEnv (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/lib/builders/GradleBuilder.js:161:23)
    at Api.module.exports.runClean (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/lib/build.js:131:20)
    at /Users/faizan/Documents/Angus-mobile/platforms/android/cordova/Api.js:391:50
    at _fulfilled (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:796:13)
    at /Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:604:44
    at runSingle (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:137:13)
    at flush (/Users/faizan/Documents/Angus-mobile/platforms/android/cordova/node_modules/q/q.js:125:13)
(node:2496) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2496) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

my sdk is also upto date i don’t understand whats the problem. Kindly help me out here.


#2

in ionic3 you don’t need to add platform

you just run : ionic cordova run android
it automaticaly addeds it


#3

yeah but as i said the default platform which ionic adds is 7.0.0 (currently) and may be due to which the application is not able to run on a device with android 6.0.0… So when i tried to add android 6.0.0 i got the errors that i mentioned in my question.