Why "Error While Adding Admob Ads In Android"? - android

Trying to add google ads in my app.
Here is the app-level build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.student.shopifysalespediasample"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
}
And I'm getting an error in this line :
implementation 'com.google.android.gms:play-services-ads:17.1.1'
The Error Reads:
All gms/firebase libraries must use the exact same version specification(mixing versions can lead to runtime crashes). Found version 17.1.1,16.0.4,16.0.3,16.0.1,16.0.0. Examples include com.google.android.gms:play-services-ads:17.1.1 and com.google.android.gms:play-services-measurement-base:16.0.4
Please help, I have almost completed my app. The final step of adding ads is remaining. Your help is highly appreciated.
Thanks!

your dependency version not same, use this dependency
implementation 'com.google.android.gms:play-services-ads:16.0.0'

Related

Errors installing Material Design for android studio

I've been getting familiar with Android Studio for the last couple of days and it has been stable for the most part , until I added the Material Design dependency and I got a whole bunch of errors when building the project.
I've been tinkering around with buildtools/sdk versions but nothing seems to work.
Here's my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "app.anuythe.com.apend"
minSdkVersion 24
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Errors:
https://i.stack.imgur.com/OYWDg.png
I suggest you upgrade to AndroidX:
dependencies {
implementation
'com.google.android.material:material:1.1.0'
implementation 'androidx.appcompat.appcompat:1.1.0'
implementation
'androidx.constraintlayout.constraintlayout:1.1.3'
}
PS: the versions are not the latest though, just pointing u in the right direction.
Cheers!

How to set up correctly the OSMbonuspack in my project?

Hello guys I tried to install the osmbonuspack in an Android Studio project. I tried this with the osmbonuspack wiki, but when I try to sync my project I get an error in this dependency. I assume that this is a compatibility problem. Can you please suggest me a solution?
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "mytestapplication.hello.com.map"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'org.osmdroid:osmdroid-android:6.0.1'
implementation 'com.github.MKergall:osmbonuspack:6.5.2'
}
-This dependency returns the error:implementation 'com.android.support:appcompat-v7:28.0.0'
SDK 28 is not compatible with appcompat-v7.
You can now upgrade to osmbonuspack 6.5.3, which get rid from this dependency to appcompat-v7.
(and also upgrade to osmdroid 6.0.3)

Error: Program type already present: android.support.v4.app

I'm working on an App in Android Studio, past 10 minutes I ran it and it works, but now I got this. I got and error at
implementation 'com.android.support:appcompact-v7:28.0.0'
Can you please tell me what should I modify?
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.quizonwheels.quizonwheels"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.volley:volley:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.ViksaaSkool:AwesomeSplash:v1.0.0'
}
The AwesomeSplash library is using v23 of the support library.
Change the implementation to:
implementation ('com.github.ViksaaSkool:AwesomeSplash:v1.0.0') {
exclude group: "com.android.support"
}

Render error android studio failed to load appcompat action bar, even after matching library versions

apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.app.newzubair.yld"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support:support-v4:28.0.0-alpha3'
implementation 'com.android.support:support-media-compat:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.0'}
apply plugin: 'com.google.gms.google-services'
So this is my gradle build, now I have corrected the android support library versions(as the chosen solution on this community suggested) I still cannot see the changes I make in XML rendered onto the emulation.
This is the screenshot
com.android.support:appcompat-v7:28.0.0-alpha3 has few bugs
change
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
to
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
Add this line android:orientation="vertical" inside your LinearLayout tag

Updating to couchbase lite 2.0.0 causing cannot resolve symbol errors

I am trying to update from couchbase.lite 1.4.0 to 2.0.0, but when I update and sync my build.gradle file I seem keep getting 'cannot resolve symbol' errors for my imports (AndroidContext, Document, and Database). After looking at the dcoumentation, it appears that all I have change change is:
implementation 'com.couchbase.lite:couchbase-lite-android:1.4.0'
to
implementation 'com.couchbase.lite:couchbase-lite-android:2.0.0'
unless I missed something else...
Here is my complete build.grade file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.my.app"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.couchbase.lite:couchbase-lite-android:2.0.0'
implementation 'com.couchbase.lite:couchbase-lite-android-forestdb:1.4.1'
}

Categories

Resources