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!
Related
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'
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)
Problem:
Render problem
Failed to load AppCompat ActionBar with unknown error. Tip: Try to refresh the layout.
A lot of people said change theme Theme.AppCompat.Light.DarkActionBar to Base.Theme.AppCompat.Light.DarkActionBar but still not solved. Of course I don't want to to this every time when I start a new project.
This problem gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "three.my.test.newtextapplication"
minSdkVersion 23
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'
}
Just change the 28 SDK to 27 and use 27.1.1 dependencies. And if you still want to use 28 then use 28-rc1. Hope this helps you to solve the problem.
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
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'
}