build failed Google io 2018 (iosched) - android

Download the project of Google IO 2018 (iosched), try to compile it in Android Studio 3.3 Canary 7, also the probe in 3.2 RC1. But I get the following error:
error: resource style/TextAppearance.MaterialComponents.BottomNavigationView.Colored (aka com.google.samples.apps.iosched:style/TextAppearance.MaterialComponents.BottomNavigationView.Colored) not found.
Checking the file style. xml, it is observed that fails to find the style TextAppearance.MaterialComponents.BottomNavigationView.Colored.
<style name="TextAppearance.IOSched.BottomNavigationView" parent="#style/TextAppearance.MaterialComponents.BottomNavigationView.Colored">
<item name="android:fontFamily">#font/google_sans</item>
<item name="android:textColor">#color/bottom_nav_item</item>
</style>
Also check that the Google Material components dependency if implemented.
implementation "com.google.android.material:material:$rootProject.materialVersion"
I can't understand why it might be making this mistake.

you can see here
https://github.com/google/iosched/issues/285#issuecomment-416114763
you can use the Android Studio Stable 3.2
use the last dependencies.
in the file iosched/gradle.properties,mofiy
androidGradlePluginVersion = '3.2.0'
materialVersion = '1.0.0'
kotlinVersion = '1.2.51'
in the file iosched/mobile/src/main/res/values/styles.xml
change
#style/TextAppearance.MaterialComponents.BottomNavigationView.Colored
to
#style/Widget.MaterialComponents.BottomNavigationView.Colored

I have managed to make it compile by installing android studio 3.2.0 beta 4.
as seen in the following image

with Android Studio 3.1.4 it builds, unless updating the outdated dependencies. there also is on open issue: https://github.com/google/iosched/issues/285
and it does complain much when building with ./gradlew build
once I've manually updated those beta01 versions to rc01 I also get that:
error: resource style/TextAppearance.MaterialComponents.BottomNavigationView.Colored (aka com.google.samples.apps.iosched:style/TextAppearance.MaterialComponents.BottomNavigationView.Colored) not found.
which basically means, that material-components-android is missing or outdated. to resolve this, you could simply copy the absent style from GitHub and manually add it into styles.xml or simply do not update that outdated library versions, until there is a final release of all those release candidates, which are not yet considered as "stable".
the bottom line may be, that it builds against materialVersion = '1.0.0-beta01' (which might contain that style), but not against materialVersion = '1.0.0-rc01' (which may lack that style).
maybe consider using a stable version of Android Studio, alike 3.1.4 - instead of using the canary channel and then complain it won't work; maybe you even build unknowingly against the rc01 version, because this is exactly the issue which I get when updating that library to rc01 - and the title of this question also boldly states RC01.

Related

Android Studio xml preview issue failed to initialize editor

After Update android studio dolphin my old projects xml preview not showing views. Is anyone facing same issue? And have done solution then please share it here.
It's run perfectly fine but preview not working.
What I did tried?
File -> Invalidate Cashes / Restart
Delete build , idea , gradle folder
Restart PC and android studio
but none of that solved my problem.
In my case, I have upgraded the project AGP (Android Gradle Plugin) and then restart the android studio.
Problem Solved.
I'm suffering from same issue/bug. What I did so far?
Attempt 1
File -> Sync Project with gradle files
File -> Invalid catch and Restart.
Delete build folder idea and .gradle folder.
Restart Android studio and restarted my pc as well.
This will do solve in one of the my project which is only 5 screen project. But not solved in my other old projects which are more than 5 year old.
Attempt 2
Tried all step from attempt 1 Also tried what siregar2103 answered
File -> Repair IDE but still have same problem ,But Repair IDE did solve my other project issue/bug.
Attempt 3
All from Attempt 1 and 2 but not solve in my main project so I decided to upgrade my years old project to latest one.
I did upgrade my Gradle from 4.1.3 to 7.3.0
Update all dependency to latest one but I face many error while doing that.
Hilt error and other errors too. Which I'm going to mention below.
For Hilt I did removed all old Hilt related library and and below
kapt "com.google.dagger:dagger-compiler:2.42"
kapt "com.google.dagger:hilt-android-compiler:2.43.2"
implementation "com.google.dagger:dagger:2.42"
implementation "com.google.dagger:hilt-android:2.43.2"
implementation 'androidx.hilt:hilt-work:1.0.0'
kapt "androidx.hilt:hilt-compiler:1.0.0"
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation "androidx.navigation:navigation-compose:2.5.1"
In build.gradle file (not .app level)
id 'com.google.dagger.hilt.android' version '2.43.2' apply false
Important note: I did add implementation "androidx.navigation:navigation-compose:2.5.1" dependency because I got
java.lang.IllegalArgumentException: CreationExtras must have a value
by SAVED_STATE_REGISTRY_OWNER_KEY error in runtime.
Other Error which I faced is
Exception is:
com.intellij.openapi.externalSystem.model.ExternalSystemException:
lateinit property _buildFeatureValues has not been initialized
For this I did build gradle using command line and it give me full error which I didn't get when I directly build don't know why? But It's through error related flat dir and aar file so I did removed flat dir code and change aar file implementation code now It's started to build and my app started to install.
Now still some of my file not rendering and that because of I'm using custom attr from style so I'm trying to figuring out why it's happening and I'll update this answer when I find solution for that.
So using above my 60% xml files preview start showing in my old projects. For 40% screen I have to change my default theme to custom theme in preview of xml so it can start rendering.
Repair IDE
Upgrade your code to latest Android Gradle Plugin
This 2 step should solve your problem. And build using command line for more error related details.
Have you try to using Repair IDE? It works for me
I ran into a similar issue when upgrading to Dolphin. I was able to solve this by changing the preview's theme from App.Starting [default] to my app's theme.
Try to update the gradle and sync files. It work for me.
The XML file in your project may contain an error. The reason may be a font issue or a file not linking correctly with your XML layout.
This is for your reference on how to find errors.
Hope you find it useful.
Check what Layout Inspectors you have enabled in Android Studio and try to let only the API 29-30 inspector active.
In my case if in xml custom views have used that my preview screen not show views if I remove or comment custom views in xml layout after that the preview screen show other view perfectly
I know removing custom layouts not solution.
for solve this issue I do following steps
First I just update Gradle plugin version to 7.3.0 from setting project structure (No working)
after that I also update com.google.gms:google-services version to 4.3.14
now every things work fine.
In my case, I have upgraded Android Gradle Plugin when update is popUp and then restart the android studio.
My Problem Solved.
I am looking as well for a soluition till now.
From what i see, it has something to do with
AGP or Cardview (Layouts). Many code snipeets relate to this issue.
I am trying to update the AGP version, but it seems, that the enveronmet is more broken than that.
I get as well an empty Field for the gradle version and plugin under settings.
For anyone can not fix this issue, i'm just need to update gradle version and buildtool
buildSrc/src/main/kotlin/Dependencies.kt
object BuildPlugins {
object Versions {
const val buildToolVersion = "7.3.0" //lower version seem not work
and change to 7.4 in gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip

Incorrect configuration. Please configure your build for VectorDrawableCompat with Gradle 7.0.2

My app, which was working before, suddenly started crashing in my LaunchActivity with: Please configure your build for VectorDrawableCompat. This is happening with Gradle 7.0.2, which doesn't make sense since other posts regarding this issue are from 3 years ago and recommend updating to gradle 2.0+ (which is much older) and also using the latest android support library (which is a non-issue now with androidx). They also recommend setting vectorDrawables.useSupportLibrary = true which has already been the case in my app. So those posts weren't relevant to my issue.
minSdkVersion 21
targetSdkVersion 31
vectorDrawables.useSupportLibrary = true
classpath 'com.android.tools.build:gradle:7.0.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
Oddly this started happening on my master after I switched to a different branch and then returned to my master branch after a month. However, the master branch shouldn't have changed at all and it must have been working before, because I cut a production release from it that previous month, and the production release wasn't crashing.
Caused by: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.
at androidx.appcompat.widget.ResourceManagerInternal.checkVectorDrawableSetup(ResourceManagerInternal.java:495)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:140)
at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:480)
at androidx.appcompat.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:93)
at androidx.appcompat.app.AppCompatDelegateImpl.attachToWindow(AppCompatDelegateImpl.java:797)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureWindow(AppCompatDelegateImpl.java:773)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreate(AppCompatDelegateImpl.java:501)
at androidx.appcompat.app.AppCompatActivity$2.onContextAvailable(AppCompatActivity.java:131)
at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable(ContextAwareHelper.java:99)
at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:297)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:273)
at com.somewearlabs.sw.ui.LaunchActivity.onCreate(LaunchActivity.kt:14)
at android.app.Activity.performCreate(Activity.java:7963)
at android.app.Activity.performCreate(Activity.java:7952)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
I finally fixed the issue. When I was inspecting the crash in Android Studio, clicking on the file/line number link (eg. "ResourceManagerInternal.java:495") opened up two options for the class, one in appcompat library version 1.2.0 and also 1.3.0. There must have been two versions used in my dependencies, even though in the build.gradle files for all of my projects explicitly stated androidx.appcompat:appcompat:1.2.0. Using a breakpoint showed that the line in 1.3.0 was getting called when launching the app.
Then I did File > Invalidate Caches and Restart.
I thought that ensuring that only one version of appcompat being used in the project might fix things, so I switched all the build.gradle files from using androidx.appcompat:appcompat 1.2.0 to 1.3.0. After resyncing/building, the crash went away. I don't know why this crash started happening in the first place - if anyone could shed some light on this - but I needed to update the appcompat dependency anyway so it worked out.

resource not found when including crosswalk into project

I've used xwalk project in mine for a while now.
However, during the last round of library version upgrades, gradle doesn't like xwalk any more. Simply including it into my project
compile 'org.xwalk:xwalk_core_library:19.49.514.5'
will produce the following error on my dimens.xml:
error: resource android:attr/fontStyle not found.
error: resource android:attr/font not found.
error: resource android:attr/fontWeight not found.
dimens.xml:
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
The conflicting attributes are actually referenced in app/build/intermediates/incremental/mergeDeployDebugResources/merged.dir/values/values.xml.
Initially I paid this no attention because I needed to develop some new functionality, but now it's time to publish and I need to make my "publish" flavor working again. The ONLY difference between gradle compiling or not being inclusion of xwalk into my project.
To make matters worse, I also upgraded Android Studio to version 3 and now I'm stuck not being able to revert my repository to something before the breaking change so that I could hunt for the issue.
I googled this a lot but it seems I'm the only one messing this up, so I'd appreciate any pointers on what I might be doing wrong.
Reverting xwalk version to an older one does not help. I'm currently using the latest version which still works on Android 4.0 (project requirement).
How can I fix this?
Edit: stupid me!!!
I didn't revert to OLD ENOUGH version of xwalk. reverting to 15.44.384.13 removes the problem.
The issue is that the attributes in question are only supported from API 16 forward and I must also work with 14 --> Even upping minSdkVersion to 16 doesn't solve the issue.
Edit2: disabling aapt2 does not help: the same errors are reported with aapt1.
Downgrading build tools from 26.0.2 to 25.0.2 does not help.
Edit3: Increasing compileSdkVersion & targetSdkVersion to 26 solves the problem. I have 22 normally because of Marshmallow permissions system. Note that it MUST be at least 26. Even 25 still produces the error.
I am allowed to leave it at 22 in the libraries I'm using, but not the main app project using xwalk.
Open build.gradle and put this at the end of the file:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
Running "cordova build android" - unable to find attribute android:fontVariationSettings and android:ttcIndex

different version number gradle file

My compiledsdkversion is 23. My Android support library has a 24.0.0-alpha1designation at the end of the string which declares it on my gradle app file. Gradle is compiling with errors stating that the support library should not use a different version than the compiledsdkversion.Any ideas on how to get rid of this error. I don't know how to update the compiledsdkversion.
You should use the latest stable version of the Support Library, which is currently 23.2.1 as per the release notes.

Android Studio 'Obsolete Gradle Dependency' inspection issue

I have following gradle dependencies in my Android build.gradle file.
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
Declared versions are the current latest stable versions of these libraries(android support library). But Android Studio displays following warning on them.
A newer version of exists than 23.2.1 is available:
24.0.0-alpha1
24.0.0-alpha1 seems to be the newly released developer preview and I don't want to take them as a stable version of libraries. I can suppress or disable this inspection and get rid of the warnings. But doing so will avoid valid future warnings as well.
How can git rid of this warning for the developer previews?. The warning should appear only if valid new stable version of the library exists.
I use Android studio 1.5.1Thanks in advance
Guys from Google has already fixed it, so all that you need to do now is to wait for the next update.
This problem has already been reported here:
https://code.google.com/p/android/issues/detail?id=203321

Categories

Resources