How to change minSdkVersion for Android build

Hi, I’m having problems adding a Cordova plugin to Meteor, the error I’m getting is this:

Errors executing Cordova commands:                                              
                                              
   While building Cordova app for platform Android:
   Error: /Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/cordova/build: Command failed with exit code 8 Error output:
   /Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/AndroidManifest.xml:29:5 Error:
   uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library
   /Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/build/intermediates/exploded-aar/io.smooch/core/2.0.1/AndroidManifest.xml
   Suggestion: use tools:overrideLibrary="io.smooch.core" to force usage
   
   FAILURE: Build failed with an exception.
   
   * What went wrong:
   Execution failed for task ':processArmv7ReleaseManifest'.
   > Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library
   /Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/build/intermediates/exploded-aar/io.smooch/core/2.0.1/AndroidManifest.xml
   Suggestion: use tools:overrideLibrary="io.smooch.core" to force usage

And I tried adding this to the Gradle file of the plugin:

android {
    compileSdkVersion 19
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 22
    }
}

And I still get this error, so I wanted to know if there is some other way to change the minSdkVersion of the Android build.

Create a mobile-config.js in your projects root folder and add some settings to it:

App.setPreference('android-targetSdkVersion', '19');
App.setPreference('android-minSdkVersion', '19');
3 Likes

Thanks, I tried what you suggested but strangely I’m still getting the error, even if I open the file in

/Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/AndroidManifest.xml

The minSdk is changed but I’m still getting this error:

=> Errors executing Cordova commands:                                              
                                              
   While building Cordova app for platform Android:
   Error: /Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/cordova/build: Command failed with exit code 8 Error output:
   /Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/AndroidManifest.xml:29:5 Error:
   uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library
   /Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/build/intermediates/exploded-aar/io.smooch/core/2.0.1/AndroidManifest.xml
   Suggestion: use tools:overrideLibrary="io.smooch.core" to force usage
   
   FAILURE: Build failed with an exception.
   
   * What went wrong:
   Execution failed for task ':processX86ReleaseManifest'.
   > Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library
   /Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/build/intermediates/exploded-aar/io.smooch/core/2.0.1/AndroidManifest.xml
   Suggestion: use tools:overrideLibrary="io.smooch.core" to force usage
   
   * Try:
   Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
   
   /Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:126
   throw e;
   ^
   Error code 1 for command: /Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/gradlew with args:
   cdvBuildRelease,-b,/Users/jeronimocosio/vno/vnomvp/.meteor/local/cordova-build/platforms/android/build.gradle,-Dorg.gradle.daemon=true
   at ChildProcess.whenDone
   (/Users/jeronimocosio/.meteor/packages/meteor-tool/.1.1.10.602kty++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
   at ChildProcess.emit (events.js:98:17)
   at maybeClose (child_process.js:766:16)
   at Socket.<anonymous> (child_process.js:979:11)
   at Socket.emit (events.js:95:17)
   at Pipe.close (net.js:466:12)

It looks like it was a conflict with Crosswalk, if I remove it then I can build for Android, thanks!

Hey guys. I’ve ran into same thing with crosswalk and cordova-plugin-facebook4. App.setPreference didn’t help. I found a couple issues on the facebook4 plugin’s repo in which the fix is kind of odd…
https://github.com/jeduan/cordova-plugin-facebook4/issues/64 and
https://github.com/jeduan/cordova-plugin-facebook4/issues/68

I’ve been digging through meteor source trying to understand the build steps to a degree where I could somehow come up with a fix that allowed these plugins to work together. Anybody have any ideas?

Getting multiple cordova plugins working nicely together has been such a headache :frowning:

So after revisiting the issue… I figured it out. Original problem was with how 1.3.1 crosswalk plugin handled minSdkVersion.

meteor remove crosswalk
meteor add cordova:cordova-plugin-crosswalk-webview@1.4.0

BOOM fixed…
Yah, I was stuck trying to copy the ./meteor/packages folder of crosswalk to make local changes (copying into project’s package folder), as I couldn’t find the source of the meteor crosswalk plugin (this doesn’t work btw, that is built code!)… but while searching the forum, I seen where a MDG developer stated it was just a package.js and we could actually just add the cordova plugin directly.

1 Like

seems to not work for me with meteor 1.3 - any other changes you have applied?

I just confirmed it still worked by re-adding it to current project using meteor 1.3.2.4. However, I went with latest version of crosswalk webview available on npm as well… 1.6.1… had issues at first but then I remembered about cleaning .meteor/local of everything except db and rebuilt and all went well.

I keep getting this error now
[ERROR:xwalk_autofill_client.cc(172)] Not implemented reached in virtual void xwalk::XWalkAutofillClient::OnFirstUserGestureObserved()

But it seems it isn’t a real error according to this… https://crosswalk-project.org/jira/browse/XWALK-6067

What error or issues are you having?

for me its working great with 1.3.2.4 and cordova-plugin-crosswalk-webview@1.6.0

I needed to add the minSdkVersion manually for it to work correctly.
App.setPreference(‘android-targetSdkVersion’, ‘15’);
App.setPreference(‘android-minSdkVersion’, ‘15’);

1 Like