Adding React-Native-Admob in React-Native

2019-08-16 02:57发布

问题:

I am trying to add React-Native-Admob 2.0.0-beta.5 into React-Native v0.55.4 for Android.

compileSdkVersion =26 
buildToolsVersion ="27.0.3"
targetSdkVersion = 26
supportLibVersion = "26.1.0"
minSdkVersion = 18

And React-Native-Admob has

compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
     minSdkVersion 16
     targetSdkVersion 22
    }

And when i Compile the error Exception occur

The SDK Build Tools revision (23.0.1) is too low for project ':react-native-admob'. Minimum required is 25.0.0

I can't downgrade my project's SDK, other package uses that SDK.

回答1:

You don't need to downgrade, you need to upgrade. Dependencies were probably added in the SDK that admob relies on. You can download the specified version packages for the SDK through Android studio and then set your SDK version in the file to the appropriate version necessary for admob.

Edit I see that you are saying that admob is using version 23. You may need to submit an issue with them on GitHub for this.



回答2:

you can change the buildToolVersion of the library you are using, just go to -> node_modules/{your-library}/android/build.gradle, change buildToolsVersion from 23.0.1 to 25.0.0.

if the studio asks for any updates regarding build, just update it, and it might work.

another solution: although I haven't tried it, it has a lot of emoji love on GitHub,

https://github.com/oblador/react-native-keychain/issues/68#issuecomment-304836725



回答3:

Goto "node-module/react-native-admob/android/build.gradle" file, then change the compileSdkVersion and buildToolsVersion to following values

compileSdkVersion 27
buildToolsVersion "27.0.3"