Reputation: 61
Running command react-native run-android
the build fails exactly at the same location and produces me the following error
:
:app:processDebugManifest
C:\Users\me\ReactApp\wats\android\app\src\main\AndroidManifest.xml:5:5-8:12 Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [wats:react-native-watson:unspecified] C:\Users\me\ReactApp\wats\node_modules\react-native-watson\android\build\intermediates\bundles\default\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.reactlibrary" to force usage
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:app:processDebugManifest FAILED
FAILURE: Build failed with an exception.
I know what this error should suppose to mean. The issue is that the referenced AndroidManifest declares the minSdkVersion to be 19 already: `
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="26"
/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
`
It clearly seems to be some kind of cache issue. The most annoying is that even if I create a completely new Native React project and install the needed packages and try to run it, then I get the same error (even if I have explicitly made sure that all those values in the Manifest are correct).
I have tried commands npm clear cache --force
which doesn't work; also, it seems that react-native run-android --reset-cache
doesn't work (found one RN ticket about it, but it seems it has never been fixed); tried gradlew clean
command under android studio, but that didn't have any effect.
Any ideas what to try?
Upvotes: 1
Views: 4304
Reputation: 61
Opened React Native project in Android Studio, and tried to compile the project from there. The process failed as well, but the error message in Android Studio was a bit more specific. From the React Native error message I got an impression that the issue laid with the AndroidManifest
file, but actually the issue was inside build.gradle
file, which indeed defined minSdkVersion
to be 16. After updating this value the problem got solved.
Upvotes: 5