20

Gradle Sync Errors are coming up on my build.gradle file for a module I imported called BaseGameUtils saying The minSdk version should not be declared in the android manifest file. I don't call this at all from what I can see, and I don't in the Android Manifest either?

But here is my build.gradle file. Please help!

Chris
  • 339
  • 1
  • 2
  • 8
  • 1
    You showed us the build.gradle file. The error message says that the problem is in the manifest file. – Stephen C Aug 11 '18 at 03:39
  • @StephenC The IDE links the error to this file also there is no code written in my AndroidManifest for the minSDK. The only place where I see it is under my Merged Manifest where I cannot delete it. – Chris Aug 11 '18 at 13:35

3 Answers3

35

Inside your manifest there must be inside which minsdkversion might have been written. Just remove <uses-sdk>....</uses-sdk>

Anubhav Gupta
  • 2,492
  • 14
  • 27
  • 1
    This tag is not in the Android Manifest but in the Merged Manifest so I cannot delete it. – Chris Aug 11 '18 at 13:34
  • remove similarly how permission is removed on this page https://stackoverflow.com/questions/31616334/how-to-remove-specific-permission-when-build-android-app-with-gradle – Anubhav Gupta Aug 11 '18 at 13:43
  • 5
    the `uses-sdk` tag can also be inside a library's manifest file. for example, opencv contains this tag, so creates the problem. – emrahgunduz Oct 01 '18 at 08:33
  • @AnubhavGupta That doesn't work. I just tried. It give an error: ""tools:node" associated with an element type "uses-sdk" is not bound." – bendangelo Oct 02 '18 at 13:48
  • @AnubhavGupta, are there side effects if I remove this line? should I add it somewhere else (I had uses-sdk in both main manifest and in library manifest) – Atara Jun 03 '19 at 12:30
  • I've just imported an old project from Eclipse and had the same issue, this answer helped me. – Ehsan Jul 02 '20 at 10:54
1

I had an issue when trying to use androidx.security on minimum SDK version 19. The lint command threw an exception on the <uses-sdk> tag. I found my answer here: https://stackoverflow.com/a/27175950/1651697 It turns out I didn't need to define the android:minSdkVersion, just override the <uses-sdk> tag.

c0nstruct0r
  • 186
  • 1
  • 6
0

currently, I'm using openCV, my solution is to change minsdk in build.gradle for module:app and build.gradle module:OpenCVLibrary with the same version. i hope it's work for you

tnfaid
  • 61
  • 4