I have looked at numerous sites and the suggestions provided here at Stack Overflow. Everything works fine with my Android Studio, except the design view does not display anything. I can drag and drop widgets or modify the XML code by hand and the text gets updated fine, but the changes just don't register on the design or blueprint. I have tried deleting and reinstalling the IDE, changing the SDK version, doing build--> clean, resetting the cache, and adding dependencies. Below is my build.gradle Anyone with a critical eye have suggestions? I don't know what I'm doing.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.mydrinkmixer.somerestaurant.mydrinkmixer"
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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
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'
}
Related
The login with Twitter works ins debug, but not in release, also the size of the apk is bigger in the debug.
Where is the problem??
i have 3 activitys
this is the build.grandle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.PolDevs.MyClickerGame"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-database:19.1.0'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.google.firebase:firebase-core:17.2.2'
implementation 'com.twitter.sdk.android:twitter-core:3.1.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
Open the documentation for all the libraries you are using and double check if they have any specific rules to be put in proguard since that is enabled during release build. proguard obfuscates you’re APK when making a release build, which means removing code like annotations and comments etc. which also reduces the size of the apk.
So for some libraries to work, you have to specify some rules in your proguard file to no obfuscate certain things. Common error to be careful of when maiking debug and release builds.
I am learning to write android apps by watching some tutorials on youtube. I follow the tutorials and try to add the recyclerview in the xml file. When I click the download button next to the recyclerview, the following message is shown:
"This operation requires the library androidx.recyclerview:recyclerview:+.
Problem: Inconsistencies in the existing project dependencies found.
Version incompatibility between:
- androidx.appcompat:appcompat:1.1.0#aar
and:
- androidx.core:core-ktx:1.1.0#aar
With the dependency:
- androidx.annotation::1.1.0
versus:
- androidx.annotation::2.0.0
The project may not compile after adding this library.
Would you like to add it anyway?"
If I choose OK and go ahead, the preview screen becomes grey.
What should I do to solve the problem?
The same problem occurs when I want to add the cardview in the xml file.
thanks in advance!!!!
The build.gradle is below:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.smartherd.msgshareapp"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Just build the project again and manually refresh the layout. :)
Android newbie here. I don't know why but I can't add specific items/elements to the activity_main.xml (NestedScrollView, CardViev, Google MapView, etc). If I try to add, let's say Google MapView, a message appears that says this :
This operation requires the library com.google.android.gms:play-services-maps:+.
Problem: Inconsistencies in the existing project dependencies found.
Version incompatibility between:
- com.google.android.material:material:1.0.0
and:
- androidx.appcompat:appcompat:1.0.0
With the dependency:
- org.mockito:mockito-core:1.9.5
versus:
- org.mockito:mockito-core:2.19.0
The project may not compile after adding this library.
Would you like to add it anyway?.
Does anybody know what seems to be the problem? Build.gradle is displayed below.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 25
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.android.material:material:1.0.0'
}
The first of your problems is that you try to use Views, items, constants, etc, of a library that does not exist in your project, with these implementations it is more than enough for you to move forward, the problem with mockito is that you possibly implemented two versions and maybe the first version uses discontinued components, and therefore. Gradle will always look for the latest version, however both libraries need to live together, I recommend that you remove mockito 1.9.5 and try to synchronize again, I hope it was helpful , good luck!
apply plugin: 'com.google.gms.google-services'
dependencies{
implementation 'com.google.android.gms:play-services-cast-framework:10.0.1'
}
I created a new Android Project in Android Studio 3.1.3 on Windows 7:
included Kotlin support
API 15: Android 4.0.3
Basic Activity
I opened content_main.xml in Design View. Even though it will have a TextView saying "Hello World" by default, this was not shown on the Design screen. Instead, what I am shown is a blank screen with "android...CoordinatorLayout" text in the center:
My build.gradle (Module: app) file is:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.test.myapplication"
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"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:28.0.0-alpha3'
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'
}
Simply put, there is a problem with the versions of com.android.support:appcompat-v7 and com.android.support:design referenced, which cause the Designer to fail. Therefore you need to downgrade from API 28 down to 27 in order to use dependencies of version 27.1.1 for these dependencies. In build.gradle (Module: app):
Change compileSdkVersion to 27
Change targetSdkVersion to 27
Reference 27.1.1 for com.android.support:appcompat-v7
Reference 27.1.1 for com.android.support:design
This is how the file will look after you make the changes:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.test.myapplication"
minSdkVersion 15
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"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:27.1.1'
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'
}
Once you make the changes to build.gradle, a pop-up will ask you to "Sync Now", if you click on it, then after syncing, your designer will work:
(If you don't have version 27 of the SDK platform installed, then go to Tools → SDK Manager, and install Android 8.1 (Oreo) -- its API level is 27.
From Android Studio, I created a Map Activity project; so, there's no custom code.
The only custom changes made was copying the URL from the google_maps_api.xml _(https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=)_ and using it to create an API key.
Android Studio: 3.0.1
Emulator: Nexus 5X with API 25
Build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "xxxx.xxx.xxxx"
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"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services-maps:11.0.0'
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'
}
Screenshot
It seems like I'm missing something; I just don't know what it is.
Try to run in your mobile. Sometimes emulator is not able to load map properly, That's why it shows blank map without loading roots.