I want to set android-22 as target android sdk. I need it as workaroud permission issue with camera on Android 6 and higher. (described here https://developer.android.com/training/permissions/requesting.html, suggested here Workaround for Android 6.0 Permissions ) But my cordova 6.2.1 sets default sdk 23. I have changed it in AndroidManifest.xml
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />
built but the apk was the same size as if I buld for android-23. So, to be sure that it is built for android-22, I have removed sdk-23 and left only sdk-22. Build didn't start and Cordova said, I need android-23 sdk
e:projectsandroidqp2>cordova build --release
Error: Please install Android target: "android-23".
Hint: Open the SDK manager by ruing: "c:androidandroid-sdktoolsandroid.bat
"
You will require:
1. "SDK Platform" for android-23
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)
, so I changed target to android-22 in project.properties and CordovaLib/project.properties as suggested here . Build failed.
E:projectsandroidqp2platformsandroidCordovaLibsrcorgapachecordovaCordovaInterfaceImpl.java:191: error: caot find symbol
getActivity().requestPermissions(permissions, requestCode);
^
symbol: method requestPermissions(String[],int)
location: class Activity
E:projectsandroidqp2platformsandroidCordovaLibsrcorgapachecordovaCordovaInterfaceImpl.java:197: error: caot find symbol
getActivity().requestPermissions(permissions, requestCode);
^
symbol: method requestPermissions(String[],int)
location: class Activity
E:projectsandroidqp2platformsandroidCordovaLibsrcorgapachecordovaCordovaInterfaceImpl.java:202: error: caot find symbol
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
^
symbol: variable M
location: class VERSION_CODES
E:projectsandroidqp2platformsandroidCordovaLibsrcorgapachecordovaCordovaInterfaceImpl.java:204: error: caot find symbol
int result = activity.checkSelfPermission(permission);
^
symbol: method checkSelfPermission(String)
location: variable activity of type Activity
E:projectsandroidqp2platformsandroidCordovaLibsrcorgapachecordovaCordovaActivity.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
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:compileReleaseJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1
Shortly, my problem is, I don't know how to target other, than newest android-23 platform. Project is empty, just created, with no plugins and no code.
Is it possible to create and build for android-22 in cordova 6.2.1. Should I downgrade cordova?
