Problem with rendering, how can I solve it? - android

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.

Related

android error: Can't determine type for tag '<macro name="m3_comp_bottom_app_bar_container_color">?attr/colorSurface</macro>'

I was having some problems with a project on my android studio. so I deleted that project and start a new one but then following error shows up when I try to run the app.
Can't determine type for tag '<macro name="m3_comp_bottom_app_bar_container_color">?attr/colorSurface</macro>'
it's very strange because I did not make any changes on to the hall project.
I tried to delete and recreate the project but it's the same error.
I have this problem too,
Use below versions in build.gradle to fix
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.0'
Simple way to fix this is by changing the :
implementation "androidx.appcompat:appcompat:1.5.1"
implementation "com.google.android.material:material:1.7.0"
with
implementation "androidx.appcompat:appcompat:1.4.1"
implementation "com.google.android.material:material:1.6.0"
this solve the problem for me ^_^'
updating android studio is the solution for me

Motion editor not working in Android studio 4.0.1

I am trying to set up motion layout in android studio 4.0.1 and everything works fine until I edit in motion editor. It render fine but as soon as I edit something in motion scene it shows .
But I use
implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
and android build tool version is
classpath 'com.android.tools.build:gradle:4.0.1'
and gradle version is
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
I try clean>rebuild the project; invalidate cache and restart, delete lib fold in .idea. Is there any thing that I miss but need to config to work with Motion Layout?
Try implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta6' instead of implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1' or other beta version here at Constraint Layout

Flutter Plugin Development - Unable to use ContextCompat in my Project

I am trying to develop a flutter plugin for android permissions. It through this error
I already search other different question here but none is solving my problem
have a look at this screenshot too
Image 2
this means I am unable to access .support class
I already tried to add
implementation 'com.android.support:appcompat-v7:28.0.0'
or
implementation 'com.android.support:appcompat-v4:28.0.0'
My Gradle file looks like this
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
}
after upgrading my plugin to Android X it through these errors
Error After Upgrading to Android X
Try migrating to AndroidX (if not already there) and change the support dependency to:
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.core:core:1.0.2'

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'
}

Error inflating class androidx.constraintlayout.widget.ConstraintLayout

After migrating to Androidx packages using Android Studio menu option Refactor -> Refactor to Androidx...
I'm getting the following error:
Error inflating class androidx.constraintlayout.widget.ConstraintLayout
Make sure constraint layout is updated to latest version:
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
And replace your xml tag names
<androidx.constraintlayout.ConstraintLayout>
with
<androidx.constraintlayout.widget.ConstraintLayout>
in every place where it appears using this shortcut:
Windows: CTRL + SHIFT + R
Mac: COMMAND + SHIFT + R
In AndroidStudio 3.3 RC2 I got it resolved by upgrading -
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
to
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
in build.gradle (Module: app)
Note:
This solution is also valid for the release version 3.3 (as per below comment by FireZenk), 3.5.2 (as per below comment by user2350644)
Just replace
<androidx.constraintlayout.ConstraintLayout>
with
<androidx.constraintlayout.widget.ConstraintLayout>
In your project's xml files.
You can use Replace in Path shortcut in mac (⇧⌘F or ⇧⌘R) and windows (Ctrl+Shift+R)
Well in my case I've tried Solution 1 which still was not working. Then I used Solution 2 along with Solution 1.
Solution 1
Updating the current version ConstraintLayout in app level build.gradle file.
From
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
Into
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
Solution 2
Invalidate Caches and Restart Android Studio (If still not working after applying Solution 1).
File → Invalidate Caches / Restart → Invalidate and Restart
I used both of them and It works fine for me.
Note: Solution 1 is important.
I've also face this issue. This issue occur only for constraintlayout dependecy version.
Use 1.1.3 version & hope your issue will be solved:
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
There are two ways to add ConstraintLayout:
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha3'
then you need to use it like this:
<android.support.constraint.ConstraintLayout
...>
</android.support.constraint.ConstraintLayout>
or using androidx:
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
then you need to use
<androidx.constraintlayout.widget.ConstraintLayout
...
>
</androidx.constraintlayout.widget.ConstraintLayout>
Do not mix those two.
Since the Android Studio is updated to 3.3 it will pop this error. I resolved it by upgrading the version for constraint layout in the build.gradle of the app level:
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
TO
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
I use an Android Studio 4.1 and this library for constraint layout:
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
which is updated on 09-Nov-20 and had the same error with inflating a Constraint Layout.
In my case on my Samsung a40 app worked but on my ZTE nubia n1 app crashed instantly.
I figured that a problem was in my layout background image because my png image was too big for an old device with a different screen resolution than the Samsung a40.
I imported a background png image through the file explorer (drawable - right-click- Show in Explorer) and there was actually the problem.
I tried to import images with Android Drawable Importer but I notice this plugin does not work anymore on Android Studio.
SOLUTION RELATED TO ANDROID DRAWABLE IMPORTER:
If you have already installed the Android Drawable Importer on your Android Studio please uninstall it before you start the process of repairing.
To repair the Android Drawable Importer you need ADI-hack-plugin which you can get by following this youtube video from Thomas Samoul.
After you repair the Android Drawable Importer just import your image with it and everything will work fine.
I ran into the same problem none of the solutions above worked. The problem, in fact , was caused by a null pointer exception thrown after I switch to NoActionBar theme while the app was using the ActionBar to setTitle(). The linked stack overflow answer helped me figure it out
Android Studio is updated version 3.3. Please remove the previous version constraintLayout
my case used this
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
Thank you
In my case i just had to update the androidx dependencies to the latest version.
EDIT In build.gradle (app) you have to look for the dependencies which contains androidx. Android studio will show you information about the latest versions of these dependencies. Using that information just the change the dependency version.
In AndroidStudio 3.4 I had to downgrade to
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
to get it working again.
Strangely, it worked for when I upgraded androidx.appcompat:...' library to
'androidx.appcompat:appcompat:1.1.0-alpha05' with constraint layout version
'androidx.constraintlayout:constraintlayout:1.1.3' on Android Studio 3.3
For those who have tried all of the above to no vain, downgrading constraintLayout worked for me (after I wrecked my head for 3 days trying everything under the sun).
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
to
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'

Categories

Resources