Android Studio throws error with empty project - android

I get that error:
style attribute 'android:attr/metaButtonBarStyle' not found
I get it on a new empty project on a just installed version of Android Studio.
I've tried rebuilding the project, adding the property metaButtonBarStyle in the generated values.xml file, disabling AAPT2 on gradle-wrapper.properties with android.enableAapt2=false, I've tried uninstalling plugins and Android Studio, starting with a just-installed version of Android Studio with an empty project and I still get the error.
this are my dependencies:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
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'
could anybody help me with this?

Downgrading which SDK you're using may help unless you need a particular one.
I know when I was using Android's SDK with the Unity game engine I had to go in and delete/rename a folder to trigger Unity to download versions of those files that worked, I don't know if a similar auto-repair is available in Android Studio but if there is you might want to locate where metaButtonBarStyle should be and rename the parent folder.

Related

Android Studio XML doesn't show anything in Design View. (empty screen)

I checked other questions, but they all are about blank screen(white screen or theme). But in my case, it shows literally nothing.
I tried 'Force Refresh Layout'. But It didn't work. And only reboot can solve problem. just closing and opening Android Studio doesn't solve this problem(I even tried with removing cache and restart.)
Which one of Android Studio is related to Design View? I don't want to reboot and even though I reboot, this problem keep occurring, So, I need some better way to solve this problem.
Try this solution and see if any one actually works
Update your constraint layout dependency
change the dependencies in your gradle module file to something like this Specially and sync it implementation'androidx.constraintlayout:constraintlayout:2.1.1'
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
Invalidate Cache/restart
File>Invalidate Cache/restart
Disable and Enable android support apk
File>Settings>plugins>Under Installed section -> disable and enable and see if it works
You will be able to see if you use any Theme.AppCompat theme to your constraint layout. For example
android:theme="#style/AppTheme.NoActionBar"

Problem with rendering, how can I solve it?

I have a problem with the preview of my app.
In the log file i have a few errors :
This is a group project but I am the only one encountering this problem. I just downloaded Android Studio so I did not touch anything in the settings.
Any idea?
Add constraint layout dependency in build.gradle
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
Just click the blue text that prompt in your console
or try to add these into your gradle (app level)
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
And you can update them to latest version if Android Studio tells you there's a new version.

Android Studio 3.1.3 render fail, missing styles, failed to insantiate one or more classes

I wanted to get started with learning to code for android devices and for this i've bought a course on udemy. Unfortunately after the third video I couldn't go on because of some very annoying problems in the Android studio version 3.1.3. I tried to solve the problems but since i'm just a very beginer in programming and espacially in java I didn't stand a chance to solve it on my own and sadly every solution which i've found on the internet didn't function. So here is my problem.
Every time I start a project (no matter which) the layout won't load. And then I get this 4 messages.
Pic 1
Pic 2
I think the render problem is because of the missing styles and the missing styles are because of the classes which failed to instantiate. I think the private ressources problem is independent. So I really have no clue how to solve this problem. I think i tried almost everything. Is it possible that it has something to do with the java development kid? I've downloaded the newest version but I'm not sure if Android Studio is using it. Or maybe something with the normal java software is wrong.
Maybe the build.gradle will help you to find a solution:
pic 3
I really appreciate your time and your answers and if you need some further information please let me know.
Thank you and kind regards
Gmunderos7
UPDATE:
I've downloaded both versions on this website:
https://developer.android.com/studio/preview/?utm_source=android-studio
And both of them don't have this problems (just the private ressource). Would you recommend using one of the versions (or maybe an older version than 3.1.3 which don't has this problems)?
And can someone even use version 3.1.3 without such problems?
Step 1: "File" -> "Invalidate caches / Restart" -> "Invalidate"
Step 2: "File" -> "Close project"
Step 3: In launcher window delete your project
Step 4: Open your project by "Open an existing Android Studio project"
Step 5: Write nice code :)
I had the same problem and i fixed it today, I changed my dependencies into these
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'android.arch.core:runtime:1.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.firebaseui:firebase-ui-firestore:4.1.0'
implementation 'com.android.support:recyclerview-v7: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'
compile 'com.google.firebase:firebase-core:16.0.0'
apply plugin: 'com.google.gms.google-services'
}

Android Studio 3.1, No cached version available for offline mode

Big problem since upgrading to Android Studio 3.1, I get:
No cached version of com.github.bumptech.glide:compiler:4.6.1 available for offline mode
But I am not in offline mode as you can see here:
I tried Clean Project and Rebuild Project, all with no success.
I even rebooted my PC.
Here's my Build.gradle:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation "com.android.support:gridlayout-v7:27.1.0"
implementation 'com.android.support:exifinterface:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.code.gson:gson:2.8.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.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
}
I ran into this issue and "offline work" was unchecked inside gradle settings. After wasting 2 hours on it, I realized that I had --offline in the Command-line options of Build, Execution, Deployment > Compiler. So make sure you don't have that command listed there when you encounter this issue.
You should close Gradle offline-work model and clear compiler Command-line Options --offline:
The only thing that worked for me was to remove the "--offline" in "File -> Settings -> Compiler -> Command-line Options".
I don't know why this parameter was there but anyway...now it's ok.
Dont know what was going on, maybe it was really due to JCenter being partly down during the day. Probably because half the globe was upgrading Android Studio to 3.1.
I cleaned the cache (70.000 files!), no effect, except from a resulting hourlong download of thousands of files, mainly from JCenter, with at least 10 fails (time outs?) along the way.
End result: Gradle still complaing about
No cached version of com.github.bumptech.glide:compiler:4.6.1 available for offline mode
Then in desparation, I modified
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
to
`compile group: 'com.github.bumptech.glide', name: 'compiler', version:` '4.6.1'
in my Build.gradle.
The result was of course an error message.
After then changing back to where I came from
compile group: 'com.github.bumptech.glide', name: 'compiler', version: '4.6.1'
Bingo: all was good, no idea why.
Thanks for your help anyway
First My English is very poor,Sorry.
I meet this problem too,when I upgrade my AndroidStudio to 3.1 and update gradle 3.0.1 to 3.1.0 ,then I build to run my project,it is error “no version of butterknife in offline mode”,but I'm sure it’s not offline mode。I have tried to a lot of ways ,doesn't work.
Then I try to add dependences in AndroidStudio ProjectStructure--app--dependences,search and selected the butterknife,and then build to run.
It works!
https://blog.csdn.net/binglumeng/article/details/79747651
I hope It can help you!
have you tried invalidating your cache and restarting your android studio?
or else if your working behind a proxy network checkout this
link

Fix the version conflict either by updating the version of the google-services plugin or updating the version of com.google.android.gms to 11.8.0 [duplicate]

This question already has an answer here:
How to add firebase-admin to my android project?
(1 answer)
Closed 5 years ago.
I'm developing an Android app using Firebase, and went to install the Admin SDK using this tutorial. In my build.gradle file in my app, I've had a couple of dependencies that have given me warnings since I added them earlier in the project, but I was still able to run the application. Once I added the dependency needed for Admin SDK, things got a little more serious...
These are the original dependencies and their warnings:
implementation 'com.google.firebase:firebase-core:11.8.0'
All gms/firebase libraries must be the exact same version specification. Found versions 9.6.0, 11.8.0
implementation 'com.android.support:appcompat-v7:26.1.0'
All com.android.support libraries must be the exact same version specification. Found versions 26.1.0, 23.4.0
I searched the whole project using the double-shift search function in Android Studio and couldn't find anything that used either of the conflicting versions mentioned (9.6.0 or 23.4.0).
Like I said, the app still ran so I carried on developing. While adding the Firebase Admin SDK, I added the following dependency to my build.gradle:
implementation 'com.google.firebase:firebase-admin:5.6.0'
When I hit 'sync' on my gradle, I got the following error:
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.8.0.
This has left me a bit confused as I believe the most recent version of com.google.firebase:firebase-admin to be 5.6.0, so I don't see how I can be getting a version conflict for using this.
My app won't run while this error exists, so any help getting past it would be very much appreciated. I'm new to Android development so it might well be something very obvious that I've missed.
Here is my full list of dependencies:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0' <-- warning
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:11.8.0' <-- warning
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.firebaseui:firebase-ui:0.6.0'
implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-admin:5.6.0' <-- introduced error
implementation 'com.google.firebase:firebase-messaging:11.8.0'
}
If I can include anything else that will help with diagnosing, please let me know!
Thanks in advance,
Mark
The Firebase admin SDK is meant for JVM servers and can't be used in tandem with client SDKs. See this great post for more details. I would recommend using Cloud Functions for admin stuff instead since they're something you control and can't be compromised on the client.

Categories

Resources