Updating to Android Studio 3.0 Canary 2 give build errors [duplicate] - android

This question already has answers here:
AAPT2 compile failed: invalid dimen on Android 3.0 Canary 1
(7 answers)
Closed 5 years ago.
Today I updated my Studio to Canary 2 and a strange build error arises:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :multipicker:generateDebugSources, :multipicker:generateDebugAndroidTestSources, :multipicker:mockableAndroidJar]
Information:0 errors
Information:0 warnings
Information:See complete output in console
Error:/home/master/AndroidStudioProjects/Reweyou/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:795 invalid drawable
Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
aapt2 compile -o /home/master/AndroidStudioProjects/Reweyou/app/build/intermediates/res/merged/debug /home/master/AndroidStudioProjects/Reweyou/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Issues:
- ERROR: /home/master/AndroidStudioProjects/Reweyou/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:795 invalid drawable
Information:BUILD FAILED in 11s

I managed to run Android Studio 3 Canary 2 with Gradle 3.0.0-alpha2 based on this answer: https://stackoverflow.com/a/44202755/3936723
I use Linux, and for me this solved the problem:
Open terminal
Type:
export LC_NUMERIC="en_US.UTF-8"
sh ./android-studio/bin/studio.sh
--OLD ANSWER--
It will work in Android Studio 3.0 Canary, if you change Gradle to
classpath 'com.android.tools.build:gradle:2.3.2'
I have the same error with com.android.tools.build:gradle:3.0.0-alpha2 version, rolling back to previous version of Gradle fix a problem for me.
Unfortunately, with older gradle plugin, I can't use advanced options in Android profiler :(

The solution has been provided here.
You need to change your PC regional format for numbers to one that use the dot as decimal mark, like English US / UK.

Android Studio Canary 2 changes Gradle to com.android.tools.build:gradle:3.0.0-alpha2
A workaround is set back to com.android.tools.build:gradle:3.0.0-alpha1

Related

React Native - :expo-modules-core:compileDebugKotlin error [duplicate]

This question already has answers here:
React Native Android build failure with different errors without any changes in code for past days due to publish of React Native version 0.71.0-rc.0
(4 answers)
Closed 4 months ago.
For some reason, Im getting this issue (build was working fine yesterday):
When I run npx react-native run-android
Im getting:
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Execution failed for task ':expo-modules-core:compileDebugKotlin'.
In terminal im also seeing this:
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
I've seen some solutions online like this. So iv added the kotlin version 1.4.1 and im getting this error when I gun gradle clean:
* What went wrong:
A problem occurred configuring root project 'ProjectName'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.4.1/kotlin-gradle-plugin-1.4.1.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.4.1/kotlin-gradle-plugin-1.4.1.pom
- https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.4.1/kotlin-gradle-plugin-1.4.1.pom
Required by:
project :
Not sure why this build has started failing. any ideas?
Check out
https://github.com/facebook/react-native/issues/35210
On November 4th 2022 a new React Native version got published which is causing some build issues.
This event resulted in build failures for Android on several users as they ended up downloading the wrong React Native version (0.71.0-rc0 instead of the version they were using in their project, say 0.68.0).
have you initiated your projects with "expo init" command or by using npx?

Android Studio Error: During launch : com.android.build.gradle.internal.res.ResourceCompilerRunnable

Tried to launch my app and get this error. I'm going crazy with new gradle 8.
How can i fix it?
I've made this command:
./gradlew :MatchUp:dependencies --warning-mode all
And then these are answers:
Starting a Gradle Daemon, 3 incompatible and 3 stopped Daemons could not be reused, use --status for details
The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 8.0. JFrog announced JCenter's sunset in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further information: https://docs.gradle.org/7.3.3/userguide/upgrading_version_6.html#jcenter_deprecation
at settings_1i0yjjkfvqy3y2on3vxaqibu6$_run_closure1$_closure2.doCall(/Users/cristiancapannini/Desktop/COLAN_WORKS/Android/MatchUp/settings.gradle:8)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
FAILURE: Build failed with an exception.
Where:
Build file '/Users/cristiancapannini/Desktop/COLAN_WORKS/Android/MatchUp/app/build.gradle' line: 2
What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
Your current JDK is located in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.
How can i fix it?
Obviously it needs to be fixed in order to still maintain the backward compatibility of the app. Thanks
with regard
Files gradle
https://drive.google.com/drive/folders/1YEFZI3W9Sn3p6urwHm2eK-Hx8wNHmJeC?usp=sharing
Cristian

Gradle build failed with an error without printing this error [duplicate]

This question already has answers here:
How to fix Unsupported class file major version 57 in maven for Java 13 and Spring
(4 answers)
Closed 2 years ago.
This is my first Android project on Kotlin. I created a project and it builds successfully, don't know but after all, when I try to run the project on my device it says build failed without giving any error:
Gradle build failed with 1 error(s) in 352 ms
First I thought it may be an error of the JDK I use, but after changing the JDK version, again it gives the same error, I am stuck please help.
You need to build that onvifcamera from source, as the JAR seems to be built with Java 13.
implementation "com.rvirin.onvif:onvifcamera:1.1.6"
Should be:
implementation project(":onvifcamera")
Older pre-packaged versions of the library might also work on Android.

Andorid Studio: ExecutionException : (integer) -1 is less than minimum integer 0

I updated to Android Studio 3 Canary build 2, which bumped up my build tools like so:
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
Now when I try to build I get this issue:
Error:.../values.xml:3490 (integer) -1 is less than minimum integer 0
Error:java.util.concurrent.ExecutionException:
com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:Execution failed for task ':app:processStagingResources'.
Failed to execute aapt
So I took a look at line 3490 of the file referenced above and got this:
<item name="android:numColumns">auto_fit</item>
Because it references I GridView style, I went to the docs and found that AUTO_FIT has a value of -1
I'm not sure why I'm getting this issue but I've tried cleaning/building, restarting and I still get that issue. Any idea what to try?
You can disable AAPT2 by putting this in your gradle.properties file:
android.enableAapt2=false
Try upgrading your build tools to 26.0.2 or newer, it was a bug in AAPT2, it should be fixed now.
If you're still using an alpha or a beta of AndroidStudio try upgrading to Android Studio 3.0.

Lint error fixing

I am getting lint error in android studio as
Error:Execution failed for task ':app:lint'. Lint found errors in the
project; aborting build. Fix the issues identified by lint, or add the
following to your build script to proceed with errors:
android {
lintOptions {
abortOnError false
} }
Information:BUILD FAILED Information:Total time: 7.288 secs Information:1 >error Information:0 warnings
Build is getting failed
But it is not showing where exactly the error and even IDE(Android studio) is also not displaying any error mark in files.
How to redirect lint error to source file.?
I don't want to skip the lint check.
Please help me.
From the command line, run gradlew lintDebug (or gradlew lint[variantName] for a different variant).
This will generate a full lint report at /app/build/outputs. I recommend the HTML version (lint-results-debug.html). In there you will find all Android lint issues and their severity.
Alternatively, you can go to Analyze > Inspect Code in Android Studio to run lint. Switch the view to group them by severity- the errors are the ones blocking your build.
The erros reports with the lines and exactly erros font are found in: Your app release builds folder, then:appname/app/build/reports.
there you will find the lint-results-release-fatal. Open it in any browser to find the problems.
Hope it helps.

Categories

Resources