minSdkVersion error 1 can not be smaller than version 4

0

I am studying a script and at the time of doing the project build it accuses version problem, but only I am having this problem in my class.

  <uses-sdk android:minSdkVersion="1" android:targetSdkVersion="1" />

Error: (5, 5) uses-sdk: minSdkVersion 1 can not be smaller than version 4 declared in library C: \ Projects \ Player \ aAALibV4 \ build \ intermediates \ exploded-aar \ com.android.support \ support- v4 \ 21.0.3 \ AndroidManifest.xml

Would it be the Android version I used to build the project problem?

    
asked by anonymous 19.06.2015 / 02:42

2 answers

1

There is no "1" version of the android, so the error message. Use 19, for example, which is kitkat.

Enter: <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" /> .

Do not forget to update build.gradle .

    
19.06.2015 / 03:02
1

This error happens because you are setting a minimum version in your project (version 1), but it imports a library that needs a higher version to work (version 4). In your case, it's the Android compatibility library: com.android.support:support-v4 .

You can fix this by modifying android:minSdkVersion="1" to android:minSdkVersion="16" , which runs from Android 4.1 (Jellybean) and covers about 90% of Android devices today, according to Google itself .

The other setting is just a way for you to state which version of Android your app was designed for and tested on. It is almost always recommended to set the latest version (which would be version 22 today). For that, just change the android:targetSdkVersion="1" to android:targetSdkVersion="22" .

In the end it will look like this:

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />

    
19.06.2015 / 03:18