Explore all Android open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Android

AndroidUtilCode

1.30.0

leakcanary

v2.9.1

swoole-src

v4.8.8

fresco

Version 2.5.0

MaterialDrawer

v9.0.0-rc01

Popular Libraries in Android

AndroidUtilCode

by Blankj doticonjavadoticon

star image 29761 doticonApache-2.0

:fire: Android developers should collect the following utils(updating).

leakcanary

by square doticonkotlindoticon

star image 27449 doticonApache-2.0

A memory leak detection library for Android.

butterknife

by JakeWharton doticonjavadoticon

star image 25707 doticonApache-2.0

Bind Android views and callbacks to fields and methods.

tips

by git-tips doticonjavascriptdoticon

star image 19842 doticonMIT

Most commonly used git tips and tricks.

material-dialogs

by afollestad doticonkotlindoticon

star image 18809 doticonApache-2.0

😍 A beautiful, fluid, and extensible dialogs API for Kotlin & Android.

PhotoView

by Baseflow doticonjavadoticon

star image 17907 doticonApache-2.0

Implementation of ImageView for Android that supports zooming, by various touch gestures.

PhotoView

by chrisbanes doticonjavadoticon

star image 17416 doticonApache-2.0

Implementation of ImageView for Android that supports zooming, by various touch gestures.

swoole-src

by swoole doticonc++doticon

star image 17354 doticonApache-2.0

🚀 Coroutine-based concurrency library for PHP

fresco

by facebook doticonjavadoticon

star image 16646 doticonMIT

An Android library for managing images and the memory they use.

Trending New libraries in Android

accompanist

by google doticonkotlindoticon

star image 4677 doticonApache-2.0

A collection of extension libraries for Jetpack Compose

ComposeCookBook

by Gurupreet doticonkotlindoticon

star image 3241 doticonMIT

A Collection on all Jetpack compose UI elements, Layouts, Widgets and Demo screens to see it's potential

BlackDex

by CodingGay doticonc++doticon

star image 2880 doticonApache-2.0

BlackDex is an Android unpack(dexdump) tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phone or emulator, you can unpack APK File in several seconds.

TapTap

by KieronQuinn doticonkotlindoticon

star image 2368 doticonGPL-3.0

Port of the double tap on back of device feature from Android 12 to any Android 7.0+ device

Foodium

by PatilShreyas doticonkotlindoticon

star image 1787 doticonMIT

🍲Foodium is a sample food blog Android application 📱 built to demonstrate the use of Modern Android development tools - (Kotlin, Coroutines, Flow, Dagger 2/Hilt, Architecture Components, MVVM, Room, Retrofit, Moshi, Material Components).

Kotlin-Coroutine-Use-Cases-on-Android

by LukasLechnerDev doticonkotlindoticon

star image 1586 doticonApache-2.0

🎓 Learning Kotlin Coroutines for Android by example. 🚀 Sample implementations for real-world Android use cases. 🛠 Unit tests included!

ConsecutiveScroller

by donkingliang doticonjavadoticon

star image 1540 doticonApache-2.0

ConsecutiveScrollerLayout是Android下支持多个滑动布局(RecyclerView、WebView、ScrollView等)和普通控件(TextView、ImageView、LinearLayou、自定义View等)持续连贯滑动的容器,它使所有的子View像一个整体一样连续顺畅滑动。并且支持布局吸顶功能。

thc-tips-tricks-hacks-cheat-sheet

by hackerschoice doticoncdoticon

star image 1447 doticon

Various tips & tricks

turbine

by cashapp doticonkotlindoticon

star image 1414 doticonApache-2.0

A small testing library for kotlinx.coroutines Flow

Top Authors in Android

1

AzharRivaldi

31 Libraries

star icon174

2

viniciusthiengo

30 Libraries

star icon213

3

hyperf

25 Libraries

star icon137

4

watson-developer-cloud

25 Libraries

star icon794

5

Oclemy

22 Libraries

star icon59

6

CyanogenMod

22 Libraries

star icon285

7

akexorcist

22 Libraries

star icon3688

8

googlecodelabs

21 Libraries

star icon2252

9

elye

21 Libraries

star icon2672

10

skydoves

20 Libraries

star icon10782

1

31 Libraries

star icon174

2

30 Libraries

star icon213

3

25 Libraries

star icon137

4

25 Libraries

star icon794

5

22 Libraries

star icon59

6

22 Libraries

star icon285

7

22 Libraries

star icon3688

8

21 Libraries

star icon2252

9

21 Libraries

star icon2672

10

20 Libraries

star icon10782

Trending Kits in Android

AR Core app allows users to experience augmented reality on their Android devices. This kit helps developers and users to experience their own 3d models.


The users have the liberty to choose their own 3d models with all the fun elements also. Please see below a sample solution kit to jumpstart your solution on AR App using Android Kit. To use this kit to build your own solution, scroll down to the Kit Deployment Instructions sections.

Development Environment

The Android Studio IDE is open source and used for this development. It has a rich UI development environment with templates to give new developers launching their innovations into Android development.

Android Libraries

ARCore is the advanced platform that enables Android app developers and users to quickly and easily build AR experiences into their mobile apps and games.

Google Sceneform is an open-source 3D framework that makes it easy for you to build ARCore apps.

Android-Gradle is the open-source Android framework used to develop AR projects.

AR Fragments are used to build these ARCore apps.

Instruction to Replace 3d Models

  1. To place your own 3d model, initially, you need to set up your Android studio with "Google Sceneform Tool (Beta)"
  2. To install Google Sceneform Tool just follow the below steps : a. Go to file > settings b. In settings, click on 'plugins' c. In plugins search for "Google Sceneform Tool" in Marketplace d. Once you find, Install and restart the Android Studio
  3. Place your 3d model obj and mtl file in sampledata folder in the application Note:- Name of the obj file should be in lowercase
  4. Make a raw folder under app > src > main > res > raw
  5. Right-click on the obj file and generate the Sceneform for your 3d model under the raw folder.

Support

If you need help to use this kit, you can email us at kandi.support@openweaver.com or direct message us on Twitter Message @OpenWeaverInc.

kandi 1-Click Install

This Java code using the Jsoup library helps to parse and process an XML hierarchy of categories and items by allowing you to extract specific information from the XML document. It enables you to select and extract only the category and item elements relevant to your task or analysis instead of manually parsing the entire document. 


The code can be used to simplify the parsing and processing of hierarchical data structures in XML documents. It demonstrates the use of two different techniques for selecting elements based on their attributes and structure. These techniques can also be applied to other XML documents, making the code a useful starting point for working with XML data in Java. 


The classes jsoup.Jsoup, jsoup.nodes.Document, jsoup.parser.Parser, and jsoup.select.Elements are part of the Jsoup library, a Java library for working with HTML and XML documents. 

  • jsoup - Jsoup class provides static methods for parsing HTML and XML documents. It takes the document's source as input, such as a URL or a string, and returns a jsoup.node. Document object that represents the parsed document.  
  • jsoup.nodes - Document class represents an in-memory representation of an HTML or XML document. It provides methods for querying and manipulating the document, such as selecting elements based on a tag name, attribute value or CSS selector. 
  • jsoup.parser - Parser class is an enumeration that provides different parsers that can be used to parse an HTML or XML document. The default parser is the HTML parser, but other parsers, such as the XML parser, can be specified for documents that require different parsing rules. 
  • jsoup.select - Elements class represents a collection of HTML or XML elements selected based on a CSS selector. It provides methods for iterating over the selected elements and performing operations on them, such as getting the text content, the attributes, or the HTML representation of the element. 


The Jsoup library to parse and process XML hierarchies of categories and items can be helpful in various applications that require processing XML data. 

Preview of the output that you will get on running this code.

Code

In this solution we have used JSOUP Library.

  1. copy the code using the "Copy" button above, and paste it in a your Java IDE.
  2. Add jsoup Library in your code.
  3. Run the file to get the Output


I hope you found this useful. I have added the link to dependent libraries, version information in the following sections.


I found this code snippet by searching for "How to parse xml tag with same tag Name" in kandi. You can try any such use case!

Environment Tested

I tested this solution in the following version. Be mindful of changes when working with other versions.


  1. The solution is created and executed in java java version "1.8.0_251"
  2. The solution is tested on Joup Library version "1.13.1"


In this solution we are going to parse Nested XML with same tag name using Jsoup in java with simple steps. This process also facilities an easy to use, hassle free method to create a hands-on working version of code which would help us parse Nested XML with same tag name using Jsoup.

Dependent Library

If you do not have Jsoup that is required to run this code , You can just install it by clicking on the above link and copying the pip install command from the Jsoup page in Kand. You can search for any dependent library on kandi like Jsoup.

Support

  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.

JSoup is a Java library used to engage with real HTML. It gives a technique to govern and parse HTML texts. JSoup can clean HTML documents.


It can extract data from HTML and do other HTML-related tasks. Utilizing Jsoup, you may parse HTML or XML tags. It aids of using the usage of the pick-out feature of the Document class. Additionally, JSoup offers APIs for editing HTML documents and adding new elements. JSoup is a versatile tool that parses XML tags in Java and works with XML in Java. It can apply to many uses. They must process, change, or parse XML data.

Here are a few times while you may use it:

  • Web scraping: It is the use of JSoup. It lets you pull data from XML documents. You download them from the internet. These documents can be RSS feeds or API answers. 
  • Data mining: JSoup can extract statistics for evaluation from large XML collections.  
  • You can use JSoup to read and confirm the HTML produced by a web app for automated testing of web applications. 
  • A Java program can process XML documents. It can also change them using JSoup. 
  • You can use JSoup in a Java application to interpret XML documents from other systems.


Here is an example of how you can parse XML tags using JSoup in Java for your application: 

Fig 1: Preview of the code snippet which I copied from the kandi.

Fig 2: code snippet continuation.

Fig 3: Preview of the output that you will get on running this code from your IDE.

Code

Using jsoup your code will be looks like this:

Instructions

  1. Copy the code using the "Copy" button above, and paste it in a Java file in your IDE(IntelliJ Preferable).
  2. Add the required dependencies and import them in java file.
  3. Run the file to generate the output.


I hope you found this useful. I have added the link to dependent libraries, version information in the following sections.


I found this code snippet by searching for 'how to parse nested xml tag with same tag name' in kandi. You can try any such use case!

Environment Tested

I tested this solution in the following IDE and versions. Be mindful of changes when working with other versions.

  1. The solution is created in IntelliJ IDE and Java jdk-'11.0.17'.
  2. The solution is tested on jsoup version-'1.7.2'


Using this solution, we are able to parse xml tags using jsoup in Java with simple steps. This process also facilities an easy way to use, hassle-free method to create a hands-on working version of code which would help us to parse the xml tags using jsoup in Java.

Dependent Libraries

You can add the dependent library in your gradle or maven files. you can get the dependancy xml in above link

You can search for any dependent library on kandi like jsoup java.

FAQ

1. How to parse XML using Jsoup in Java?

To parse XML with Jsoup in Java, use the Jsoup.parse() method, providing the XML string as input.


2. Can Jsoup handle large XML files?

Jsoup is better for parsing HTML. For large XML files, use dedicated XML parsers like JAXB or SAX.


3. How to select XML elements with Jsoup selectors?

Use Jsoup selectors. They are like CSS selectors. They target and extract specific XML elements from the parsed document.


4. Is Jsoup suitable for parsing complex XML structures?

The creators of Jsoup designed it for HTML parsing. For complex XML structures, consider using specialized XML libraries like DOM or StAX.


5. How to extract data from XML attributes using Jsoup?

Use Jsoup's Element.attr() method to retrieve values from XML attributes.

Support

  1. For any support on kandi solution kits, please use the chat
  2. For further learning resources, visit the Open Weaver Community learning page.

Trending Discussions on Android

Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'

Could not GET 'play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

Message "error: resource android:attr/lStar not found"

Your project requires a newer version of the Kotlin Gradle plugin. (Android Studio)

Allow insecure protocols, android gradle

Android app won't build -- The minCompileSdk (31) specified in a dependency's androidx.work:work-runtime:2.7.0-beta01

Unable to load class AndroidComponentsExtension after upgrading the Android Gradle Plugin 7.1

Why Device Manager don't open?

Can't import module in Android Studio Arctic Fox

Unable to find bundled Java version with flutter doctor, after updating Android studio Arctic Fox(2020.3.1) on M1 Apple Silicon

QUESTION

Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'

Asked 2022-Apr-04 at 13:12

I want to add jitpack.io as a repository in my gradle file. This is my gradle root file:

1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath "com.android.tools.build:gradle:7.0.2"
8        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
9
10        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1'
11
12        // NOTE: Do not place your application dependencies here; they belong
13        // in the individual module build.gradle files
14    }
15}
16task clean(type: Delete) {
17    delete rootProject.buildDir
18}
19

Since I DON'T have a "allrepositories" to put my dependency there (only works there), I've created and added this code after buildscript code:

1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath "com.android.tools.build:gradle:7.0.2"
8        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
9
10        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1'
11
12        // NOTE: Do not place your application dependencies here; they belong
13        // in the individual module build.gradle files
14    }
15}
16task clean(type: Delete) {
17    delete rootProject.buildDir
18}
19allprojects {
20    repositories {
21        maven {url 'https://www.jitpack.io'}
22    }
23}
24

But this is the error I get

1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath "com.android.tools.build:gradle:7.0.2"
8        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
9
10        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1'
11
12        // NOTE: Do not place your application dependencies here; they belong
13        // in the individual module build.gradle files
14    }
15}
16task clean(type: Delete) {
17    delete rootProject.buildDir
18}
19allprojects {
20    repositories {
21        maven {url 'https://www.jitpack.io'}
22    }
23}
24Caused by: org.gradle.api.InvalidUserCodeException: Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'
25

ANSWER

Answered 2021-Sep-16 at 11:02

Android introduced a new way to define repositories.

Remove the dependencyResolutionManagement block from the setting.gradle file to have your project work the old way.

Source https://stackoverflow.com/questions/69163511

QUESTION

Could not GET 'play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

Asked 2022-Mar-28 at 07:02

I have a project which was running well yesterday, but today I find this problem:

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not resolve com.google.android.gms:play-services-location:16.+. Required by: project :app > project :location > Failed to list versions for com.google.android.gms:play-services-location. > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml. > Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. > Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

acutely I'm using classpath 'com.android.tools.build:gradle:4.1.0'with distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip I have followed this question and I upgraded 'com.android.tools.build:gradle:4.1.0' to classpath 'com.android.tools.build:gradle:4.2.0' then I changed distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip to distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip but I still got the error.

my android/build.gradle:

1buildscript {
2    repositories {
3        google()
4        jcenter()
5    }
6
7    dependencies {
8        classpath 'com.android.tools.build:gradle:4.2.0'
9    }
10}
11
12allprojects {
13    repositories {
14        google()
15        jcenter()
16    }
17}
18
19rootProject.buildDir = '../build'
20subprojects {
21    project.buildDir = "${rootProject.buildDir}/${project.name}"
22}
23subprojects {
24    project.evaluationDependsOn(':app')
25}
26
27task clean(type: Delete) {
28    delete rootProject.buildDir
29}
30

and gradle-wrapper.properties:

1buildscript {
2    repositories {
3        google()
4        jcenter()
5    }
6
7    dependencies {
8        classpath 'com.android.tools.build:gradle:4.2.0'
9    }
10}
11
12allprojects {
13    repositories {
14        google()
15        jcenter()
16    }
17}
18
19rootProject.buildDir = '../build'
20subprojects {
21    project.buildDir = "${rootProject.buildDir}/${project.name}"
22}
23subprojects {
24    project.evaluationDependsOn(':app')
25}
26
27task clean(type: Delete) {
28    delete rootProject.buildDir
29}
30distributionBase=GRADLE_USER_HOME
31distributionPath=wrapper/dists
32zipStoreBase=GRADLE_USER_HOME
33zipStorePath=wrapper/dists
34distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
35

Also I have changed the compileSdkVersion , minSdkVersion and targetSdkVersion to be 30 but nothing happened.

ANSWER

Answered 2021-Dec-01 at 09:09

It looks like a temporary issue, the server with these libraries is down. I have the same problem now with Room:

1buildscript {
2    repositories {
3        google()
4        jcenter()
5    }
6
7    dependencies {
8        classpath 'com.android.tools.build:gradle:4.2.0'
9    }
10}
11
12allprojects {
13    repositories {
14        google()
15        jcenter()
16    }
17}
18
19rootProject.buildDir = '../build'
20subprojects {
21    project.buildDir = "${rootProject.buildDir}/${project.name}"
22}
23subprojects {
24    project.evaluationDependsOn(':app')
25}
26
27task clean(type: Delete) {
28    delete rootProject.buildDir
29}
30distributionBase=GRADLE_USER_HOME
31distributionPath=wrapper/dists
32zipStoreBase=GRADLE_USER_HOME
33zipStorePath=wrapper/dists
34distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
35Could not GET 'https://google.bintray.com/exoplayer/androidx/room/room-common/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
36

You can try using offline mode if you're using Android Studio, then it will use the cached version of this library if you have it until it is fixed.

UPD. I switched to an alpha version of a flutter lib which caused this (workmanager) and it works well now. As far as I understand it was depending on an old version of Android Room library which is not available anymore since Bintray is not available. The new version of Room is available as it's being downloaded thorough another link. So for you the solution could be updating to a newer version of Flutter location package or forking it and changing the version of play-services-location to the most recent one.

Source https://stackoverflow.com/questions/70166663

QUESTION

Message "error: resource android:attr/lStar not found"

Asked 2022-Mar-23 at 14:37

A Flutter Android app I developed suddenly compiled wrong today.

Error:

What went wrong:

Execution failed for task ':app:processDebugResources'.

Android resource linking failed /Users/xxx/.gradle/caches/transforms-2/files-2.1/5d04bb4852dc27334fe36f129faf6500/res/values/values.xml:115:5-162:25: AAPT: error: resource android:attr/lStar not found.

error: failed linking references.

I tried

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

The build failed in 16 seconds.

ANSWER

Answered 2021-Sep-02 at 19:05

Are you using the @react-native-community/netinfo library? You need to refresh this library if you are using it.

After updating or uninstalling and reinstalling the netinfo library it will work.

Source https://stackoverflow.com/questions/69033022

QUESTION

Your project requires a newer version of the Kotlin Gradle plugin. (Android Studio)

Asked 2022-Mar-17 at 15:50

I've just updated my flutter project packages to be null-safety compliant and now Android Studio wants me to update my project to use the latest version of Kotling Gradle Plugin. Can't see where to change this though. I have tried to change "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" into "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10" but this has no effect.

My build.grade-file looks like this:

1def localProperties = new Properties()
2def localPropertiesFile = rootProject.file('local.properties')
3if (localPropertiesFile.exists()) {
4    localPropertiesFile.withReader('UTF-8') { reader ->
5        localProperties.load(reader)
6    }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12}
13
14def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15if (flutterVersionCode == null) {
16    flutterVersionCode = '1'
17}
18
19def flutterVersionName = localProperties.getProperty('flutter.versionName')
20if (flutterVersionName == null) {
21    flutterVersionName = '1.0'
22}
23
24apply plugin: 'com.android.application'
25apply plugin: 'kotlin-android'
26apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27
28def keystoreProperties = new Properties()
29def keystorePropertiesFile = rootProject.file('key.properties')
30if (keystorePropertiesFile.exists()) {
31    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
32}
33
34android {
35    compileSdkVersion 31
36
37    sourceSets {
38        main.java.srcDirs += 'src/main/kotlin'
39    }
40
41    lintOptions {
42        disable 'InvalidPackage'
43    }
44
45    defaultConfig {
46        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47        applicationId "*********"
48        minSdkVersion 30
49        targetSdkVersion 30
50        versionCode flutterVersionCode.toInteger()
51        versionName flutterVersionName
52        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
53    }
54
55
56
57    signingConfigs {
58        release {
59            keyAlias keystoreProperties['keyAlias']
60            keyPassword keystoreProperties['keyPassword']
61            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
62            storePassword keystoreProperties['storePassword']
63        }
64    }
65    buildTypes {
66        release {
67            signingConfig signingConfigs.release
68        }
69    }
70
71}
72
73flutter {
74    source '../..'
75}
76
77dependencies {
78    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
79    testImplementation 'junit:junit:4.12'
80    androidTestImplementation 'androidx.test:runner:1.1.1'
81    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
82    implementation 'com.google.firebase:firebase-analytics:17.2.2'
83}
84apply plugin: 'com.google.gms.google-services'
85

Build output:

1def localProperties = new Properties()
2def localPropertiesFile = rootProject.file('local.properties')
3if (localPropertiesFile.exists()) {
4    localPropertiesFile.withReader('UTF-8') { reader ->
5        localProperties.load(reader)
6    }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12}
13
14def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15if (flutterVersionCode == null) {
16    flutterVersionCode = '1'
17}
18
19def flutterVersionName = localProperties.getProperty('flutter.versionName')
20if (flutterVersionName == null) {
21    flutterVersionName = '1.0'
22}
23
24apply plugin: 'com.android.application'
25apply plugin: 'kotlin-android'
26apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27
28def keystoreProperties = new Properties()
29def keystorePropertiesFile = rootProject.file('key.properties')
30if (keystorePropertiesFile.exists()) {
31    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
32}
33
34android {
35    compileSdkVersion 31
36
37    sourceSets {
38        main.java.srcDirs += 'src/main/kotlin'
39    }
40
41    lintOptions {
42        disable 'InvalidPackage'
43    }
44
45    defaultConfig {
46        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47        applicationId "*********"
48        minSdkVersion 30
49        targetSdkVersion 30
50        versionCode flutterVersionCode.toInteger()
51        versionName flutterVersionName
52        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
53    }
54
55
56
57    signingConfigs {
58        release {
59            keyAlias keystoreProperties['keyAlias']
60            keyPassword keystoreProperties['keyPassword']
61            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
62            storePassword keystoreProperties['storePassword']
63        }
64    }
65    buildTypes {
66        release {
67            signingConfig signingConfigs.release
68        }
69    }
70
71}
72
73flutter {
74    source '../..'
75}
76
77dependencies {
78    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
79    testImplementation 'junit:junit:4.12'
80    androidTestImplementation 'androidx.test:runner:1.1.1'
81    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
82    implementation 'com.google.firebase:firebase-analytics:17.2.2'
83}
84apply plugin: 'com.google.gms.google-services'
85BUILD FAILED in 8s
86[!] Your project requires a newer version of the Kotlin Gradle plugin.
87    Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update project/android/build.gradle:
88    ext.kotlin_version = '<latest-version>'
89Exception: Gradle task assembleDebug failed with exit code 1
90

ANSWER

Answered 2022-Jan-30 at 21:52

change build gradle to this :

1def localProperties = new Properties()
2def localPropertiesFile = rootProject.file('local.properties')
3if (localPropertiesFile.exists()) {
4    localPropertiesFile.withReader('UTF-8') { reader ->
5        localProperties.load(reader)
6    }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12}
13
14def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15if (flutterVersionCode == null) {
16    flutterVersionCode = '1'
17}
18
19def flutterVersionName = localProperties.getProperty('flutter.versionName')
20if (flutterVersionName == null) {
21    flutterVersionName = '1.0'
22}
23
24apply plugin: 'com.android.application'
25apply plugin: 'kotlin-android'
26apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27
28def keystoreProperties = new Properties()
29def keystorePropertiesFile = rootProject.file('key.properties')
30if (keystorePropertiesFile.exists()) {
31    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
32}
33
34android {
35    compileSdkVersion 31
36
37    sourceSets {
38        main.java.srcDirs += 'src/main/kotlin'
39    }
40
41    lintOptions {
42        disable 'InvalidPackage'
43    }
44
45    defaultConfig {
46        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47        applicationId "*********"
48        minSdkVersion 30
49        targetSdkVersion 30
50        versionCode flutterVersionCode.toInteger()
51        versionName flutterVersionName
52        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
53    }
54
55
56
57    signingConfigs {
58        release {
59            keyAlias keystoreProperties['keyAlias']
60            keyPassword keystoreProperties['keyPassword']
61            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
62            storePassword keystoreProperties['storePassword']
63        }
64    }
65    buildTypes {
66        release {
67            signingConfig signingConfigs.release
68        }
69    }
70
71}
72
73flutter {
74    source '../..'
75}
76
77dependencies {
78    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
79    testImplementation 'junit:junit:4.12'
80    androidTestImplementation 'androidx.test:runner:1.1.1'
81    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
82    implementation 'com.google.firebase:firebase-analytics:17.2.2'
83}
84apply plugin: 'com.google.gms.google-services'
85BUILD FAILED in 8s
86[!] Your project requires a newer version of the Kotlin Gradle plugin.
87    Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update project/android/build.gradle:
88    ext.kotlin_version = '<latest-version>'
89Exception: Gradle task assembleDebug failed with exit code 1
90classpath 'com.android.tools.build:gradle:4.1.0'
91

and gradle-wrapper to this :

1def localProperties = new Properties()
2def localPropertiesFile = rootProject.file('local.properties')
3if (localPropertiesFile.exists()) {
4    localPropertiesFile.withReader('UTF-8') { reader ->
5        localProperties.load(reader)
6    }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12}
13
14def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15if (flutterVersionCode == null) {
16    flutterVersionCode = '1'
17}
18
19def flutterVersionName = localProperties.getProperty('flutter.versionName')
20if (flutterVersionName == null) {
21    flutterVersionName = '1.0'
22}
23
24apply plugin: 'com.android.application'
25apply plugin: 'kotlin-android'
26apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27
28def keystoreProperties = new Properties()
29def keystorePropertiesFile = rootProject.file('key.properties')
30if (keystorePropertiesFile.exists()) {
31    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
32}
33
34android {
35    compileSdkVersion 31
36
37    sourceSets {
38        main.java.srcDirs += 'src/main/kotlin'
39    }
40
41    lintOptions {
42        disable 'InvalidPackage'
43    }
44
45    defaultConfig {
46        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47        applicationId "*********"
48        minSdkVersion 30
49        targetSdkVersion 30
50        versionCode flutterVersionCode.toInteger()
51        versionName flutterVersionName
52        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
53    }
54
55
56
57    signingConfigs {
58        release {
59            keyAlias keystoreProperties['keyAlias']
60            keyPassword keystoreProperties['keyPassword']
61            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
62            storePassword keystoreProperties['storePassword']
63        }
64    }
65    buildTypes {
66        release {
67            signingConfig signingConfigs.release
68        }
69    }
70
71}
72
73flutter {
74    source '../..'
75}
76
77dependencies {
78    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
79    testImplementation 'junit:junit:4.12'
80    androidTestImplementation 'androidx.test:runner:1.1.1'
81    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
82    implementation 'com.google.firebase:firebase-analytics:17.2.2'
83}
84apply plugin: 'com.google.gms.google-services'
85BUILD FAILED in 8s
86[!] Your project requires a newer version of the Kotlin Gradle plugin.
87    Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update project/android/build.gradle:
88    ext.kotlin_version = '<latest-version>'
89Exception: Gradle task assembleDebug failed with exit code 1
90classpath 'com.android.tools.build:gradle:4.1.0'
91distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
92

Source https://stackoverflow.com/questions/70919127

QUESTION

Allow insecure protocols, android gradle

Asked 2022-Mar-17 at 10:30

I recently updated my android studio to Arctic Fox and got an error in my project

1A problem occurred configuring root project 'so10'.
2> Could not resolve all dependencies for configuration ':classpath'.
3   > Using insecure protocols with repositories, without explicit opt-in, is     unsupported. Switch Maven repository 
4'maven3(http://oss.sonatype.org/content/repositories/snapshots)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
5 See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. 
6

This is my gradle where the problem occurs

1A problem occurred configuring root project 'so10'.
2> Could not resolve all dependencies for configuration ':classpath'.
3   > Using insecure protocols with repositories, without explicit opt-in, is     unsupported. Switch Maven repository 
4'maven3(http://oss.sonatype.org/content/repositories/snapshots)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
5 See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. 
6repositories {
7    // maven { url 'https://maven.fabric.io/public' }
8    maven { url "https://jitpack.io" }
9    maven { url 'https://raw.github.com/Raizlabs/maven-releases/master/releases' }
10    maven { url 'http://oss.sonatype.org/content/repositories/snapshots'}
11    maven { url "https://plugins.gradle.org/m2/" }
12    maven { url 'https://maven.google.com'  }
13    google()
14    mavenCentral()
15    jcenter()
16}
17

How do I solve it?

ANSWER

Answered 2022-Mar-17 at 10:30

For insecure HTTP connections in Gradle 7+ versions, we need to specify a boolean allowInsecureProtocol as true to MavenArtifactRepository closure.
Since you have received this error for sonatype repository, you need to set the repositories as below:

  1. Groovy DSL
1A problem occurred configuring root project 'so10'.
2> Could not resolve all dependencies for configuration ':classpath'.
3   > Using insecure protocols with repositories, without explicit opt-in, is     unsupported. Switch Maven repository 
4'maven3(http://oss.sonatype.org/content/repositories/snapshots)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
5 See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. 
6repositories {
7    // maven { url 'https://maven.fabric.io/public' }
8    maven { url "https://jitpack.io" }
9    maven { url 'https://raw.github.com/Raizlabs/maven-releases/master/releases' }
10    maven { url 'http://oss.sonatype.org/content/repositories/snapshots'}
11    maven { url "https://plugins.gradle.org/m2/" }
12    maven { url 'https://maven.google.com'  }
13    google()
14    mavenCentral()
15    jcenter()
16}
17repositories {
18    maven {
19        url "http://oss.sonatype.org/content/repositories/snapshots"
20        allowInsecureProtocol = true
21    }
22    // other repositories ...
23}
24
  1. Kotlin DSL
1A problem occurred configuring root project 'so10'.
2> Could not resolve all dependencies for configuration ':classpath'.
3   > Using insecure protocols with repositories, without explicit opt-in, is     unsupported. Switch Maven repository 
4'maven3(http://oss.sonatype.org/content/repositories/snapshots)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
5 See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. 
6repositories {
7    // maven { url 'https://maven.fabric.io/public' }
8    maven { url "https://jitpack.io" }
9    maven { url 'https://raw.github.com/Raizlabs/maven-releases/master/releases' }
10    maven { url 'http://oss.sonatype.org/content/repositories/snapshots'}
11    maven { url "https://plugins.gradle.org/m2/" }
12    maven { url 'https://maven.google.com'  }
13    google()
14    mavenCentral()
15    jcenter()
16}
17repositories {
18    maven {
19        url "http://oss.sonatype.org/content/repositories/snapshots"
20        allowInsecureProtocol = true
21    }
22    // other repositories ...
23}
24repositories {
25    maven {
26        url = uri("http://oss.sonatype.org/content/repositories/snapshots")
27        isAllowInsecureProtocol = true
28    }
29    // other repositories ...
30}
31

Source https://stackoverflow.com/questions/68585885

QUESTION

Android app won't build -- The minCompileSdk (31) specified in a dependency's androidx.work:work-runtime:2.7.0-beta01

Asked 2022-Mar-11 at 16:01

I'm trying to build a project in my M1,

but I got this error when I run npx react-native run-android

1FAILURE: Build failed with an exception.
2
3* What went wrong:
4Execution failed for task ':app:checkDebugAarMetadata'.
5> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
6   > The minCompileSdk (31) specified in a
7     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
8     is greater than this module's compileSdkVersion (android-30).
9     Dependency: androidx.work:work-runtime:2.7.0-beta01.
10     AAR metadata file: /Users/macpro/.gradle/caches/transforms-3/999e9d813832e06d8f1b7de52647a502/transformed/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
11

Android/build.gradle

1FAILURE: Build failed with an exception.
2
3* What went wrong:
4Execution failed for task ':app:checkDebugAarMetadata'.
5> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
6   > The minCompileSdk (31) specified in a
7     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
8     is greater than this module's compileSdkVersion (android-30).
9     Dependency: androidx.work:work-runtime:2.7.0-beta01.
10     AAR metadata file: /Users/macpro/.gradle/caches/transforms-3/999e9d813832e06d8f1b7de52647a502/transformed/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
11// Top-level build file where you can add configuration options common to all sub-projects/modules.
12
13buildscript {
14    ext {
15        buildToolsVersion = "30.0.0"
16        minSdkVersion = 21
17        compileSdkVersion = 30
18        targetSdkVersion = 30
19        supportLibVersion   = "28.0.0"
20    }
21    repositories {
22        google()
23        jcenter()
24    }
25    dependencies {
26        classpath('com.android.tools.build:gradle:4.1.2')
27        classpath('com.google.gms:google-services:4.3.0')
28        // NOTE: Do not place your application dependencies here; they belong
29        // in the individual module build.gradle files
30    }
31}
32
33allprojects {
34    repositories {
35        mavenLocal()
36        maven {
37            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
38            url("$rootDir/../node_modules/react-native/android")
39        }
40        maven {
41            // Android JSC is installed from npm
42            url("$rootDir/../node_modules/jsc-android/dist")
43        }
44
45        google()
46        jcenter()
47        maven { url 'https://www.jitpack.io' }
48    }
49    
50}
51

gradle-wrapper.properties

1FAILURE: Build failed with an exception.
2
3* What went wrong:
4Execution failed for task ':app:checkDebugAarMetadata'.
5> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
6   > The minCompileSdk (31) specified in a
7     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
8     is greater than this module's compileSdkVersion (android-30).
9     Dependency: androidx.work:work-runtime:2.7.0-beta01.
10     AAR metadata file: /Users/macpro/.gradle/caches/transforms-3/999e9d813832e06d8f1b7de52647a502/transformed/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
11// Top-level build file where you can add configuration options common to all sub-projects/modules.
12
13buildscript {
14    ext {
15        buildToolsVersion = "30.0.0"
16        minSdkVersion = 21
17        compileSdkVersion = 30
18        targetSdkVersion = 30
19        supportLibVersion   = "28.0.0"
20    }
21    repositories {
22        google()
23        jcenter()
24    }
25    dependencies {
26        classpath('com.android.tools.build:gradle:4.1.2')
27        classpath('com.google.gms:google-services:4.3.0')
28        // NOTE: Do not place your application dependencies here; they belong
29        // in the individual module build.gradle files
30    }
31}
32
33allprojects {
34    repositories {
35        mavenLocal()
36        maven {
37            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
38            url("$rootDir/../node_modules/react-native/android")
39        }
40        maven {
41            // Android JSC is installed from npm
42            url("$rootDir/../node_modules/jsc-android/dist")
43        }
44
45        google()
46        jcenter()
47        maven { url 'https://www.jitpack.io' }
48    }
49    
50}
51distributionBase=GRADLE_USER_HOME
52distributionPath=wrapper/dists
53distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
54zipStoreBase=GRADLE_USER_HOME
55zipStorePath=wrapper/dists
56

ANSWER

Answered 2021-Sep-02 at 23:03

The error is being caused because one of your dependencies is internally using WorkManager 2.7.0-beta01 that was released today (which needs API 31). In my case it was CheckAarMetadata.kt.

You can fix it by forcing Gradle to use an older version of Work Manager for the transitive dependency that works with API 30. In your build.gradle file add:

1FAILURE: Build failed with an exception.
2
3* What went wrong:
4Execution failed for task ':app:checkDebugAarMetadata'.
5> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
6   > The minCompileSdk (31) specified in a
7     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
8     is greater than this module's compileSdkVersion (android-30).
9     Dependency: androidx.work:work-runtime:2.7.0-beta01.
10     AAR metadata file: /Users/macpro/.gradle/caches/transforms-3/999e9d813832e06d8f1b7de52647a502/transformed/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
11// Top-level build file where you can add configuration options common to all sub-projects/modules.
12
13buildscript {
14    ext {
15        buildToolsVersion = "30.0.0"
16        minSdkVersion = 21
17        compileSdkVersion = 30
18        targetSdkVersion = 30
19        supportLibVersion   = "28.0.0"
20    }
21    repositories {
22        google()
23        jcenter()
24    }
25    dependencies {
26        classpath('com.android.tools.build:gradle:4.1.2')
27        classpath('com.google.gms:google-services:4.3.0')
28        // NOTE: Do not place your application dependencies here; they belong
29        // in the individual module build.gradle files
30    }
31}
32
33allprojects {
34    repositories {
35        mavenLocal()
36        maven {
37            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
38            url("$rootDir/../node_modules/react-native/android")
39        }
40        maven {
41            // Android JSC is installed from npm
42            url("$rootDir/../node_modules/jsc-android/dist")
43        }
44
45        google()
46        jcenter()
47        maven { url 'https://www.jitpack.io' }
48    }
49    
50}
51distributionBase=GRADLE_USER_HOME
52distributionPath=wrapper/dists
53distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
54zipStoreBase=GRADLE_USER_HOME
55zipStorePath=wrapper/dists
56dependencies {
57    def work_version = "2.6.0"
58    // Force WorkManager 2.6.0 for transitive dependency
59    implementation("androidx.work:work-runtime-ktx:$work_version") {
60        force = true
61    }
62}
63

This should fix it.

Source https://stackoverflow.com/questions/69037481

QUESTION

Unable to load class AndroidComponentsExtension after upgrading the Android Gradle Plugin 7.1

Asked 2022-Mar-07 at 20:34

I recently downloaded Android Studio Bumblebee and it helpfully asked whether I wanted to upgrade to Android Gradle Plugin 7.1.0, the version that shipped alongside Android Studio Bumblebee.

After upgrading, I get a build error:

1Unable to load class 'com.android.build.api.extension.AndroidComponentsExtension'.
2
3This is an unexpected error. Please file a bug containing the idea.log file.
4

And looking at the idea.log file, I see:

1Unable to load class 'com.android.build.api.extension.AndroidComponentsExtension'.
2
3This is an unexpected error. Please file a bug containing the idea.log file.
4A problem occurred evaluating project ':main'.
5    at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:103)
6    ...
7Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':main'.
8    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
9    ...
10Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
11    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
12    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
13    ...
14Caused by: java.lang.ClassNotFoundException: com.android.build.api.extension.AndroidComponentsExtension
15

Which means I can't run my app and I need to downgrade the AGP 7.0 to get things working again. How do I fix this and upgrade to Android Gradle Plugin 7.1.0?

ANSWER

Answered 2022-Feb-11 at 04:05

Updating Navigation Safe Args

These lines are the important ones to look at:

1Unable to load class 'com.android.build.api.extension.AndroidComponentsExtension'.
2
3This is an unexpected error. Please file a bug containing the idea.log file.
4A problem occurred evaluating project ':main'.
5    at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:103)
6    ...
7Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':main'.
8    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
9    ...
10Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
11    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
12    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
13    ...
14Caused by: java.lang.ClassNotFoundException: com.android.build.api.extension.AndroidComponentsExtension
15Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
16    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
17    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
18

This indicates that the error is coming from the Navigation Safe Args plugin.

As per the Android Gradle Plugin 7.1.0 release notes:

AGP APIs that the Navigation Safe Args Gradle plugin depend on have been removed. AGP 7.1 does not work with Navigation Safe Args versions 2.4.0-rc1 or 2.4.0, but will work with versions 2.5.0-alpha01 and 2.4.1. In the meantime, as a workaround, you can use AGP 7.1 with a snapshot build of Navigation Safe Args, Navigation 2.5.0-SNAPSHOT. To use the snapshot build, follow the snapshot instructions with build id #8054565.

As Navigation 2.4.1 is now available, you can upgrade to that version of Navigation to gain the fix:

Backported from Navigation 2.5.0-alpha01: Safe Args now depends on Android Gradle Plugin version 7.0.4. This means that Navigation Safe Args will no longer be compatible with Android Studio versions prior to 7.0, but is now compatible with Android Gradle Plugin 7.1.0 and higher.

1Unable to load class 'com.android.build.api.extension.AndroidComponentsExtension'.
2
3This is an unexpected error. Please file a bug containing the idea.log file.
4A problem occurred evaluating project ':main'.
5    at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:103)
6    ...
7Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':main'.
8    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
9    ...
10Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
11    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
12    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
13    ...
14Caused by: java.lang.ClassNotFoundException: com.android.build.api.extension.AndroidComponentsExtension
15Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
16    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
17    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
18dependencies {
19    classpath 'com.android.tools.build:gradle:7.1.0'
20
21    // Update this line to use 2.4.1
22    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.4.1"
23}
24

Note that you should always use the same version of the Navigation library as the Safe Args plugin (i.e., your app should also use Navigation 2.4.1): you should not try to use the Navigation 2.4.1+ Safe Args plugin with an earlier version of Navigation (such as 2.3.5).

Note on Firebase Perf Plugin

Note that you might see this same error when you are using:

1Unable to load class 'com.android.build.api.extension.AndroidComponentsExtension'.
2
3This is an unexpected error. Please file a bug containing the idea.log file.
4A problem occurred evaluating project ':main'.
5    at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:103)
6    ...
7Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':main'.
8    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
9    ...
10Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
11    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
12    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
13    ...
14Caused by: java.lang.ClassNotFoundException: com.android.build.api.extension.AndroidComponentsExtension
15Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
16    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
17    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
18dependencies {
19    classpath 'com.android.tools.build:gradle:7.1.0'
20
21    // Update this line to use 2.4.1
22    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.4.1"
23}
24classpath "com.google.firebase:perf-plugin:1.4.0"
25

With an idea.log of that states:

1Unable to load class 'com.android.build.api.extension.AndroidComponentsExtension'.
2
3This is an unexpected error. Please file a bug containing the idea.log file.
4A problem occurred evaluating project ':main'.
5    at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:103)
6    ...
7Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':main'.
8    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
9    ...
10Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
11    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
12    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
13    ...
14Caused by: java.lang.ClassNotFoundException: com.android.build.api.extension.AndroidComponentsExtension
15Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
16    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
17    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
18dependencies {
19    classpath 'com.android.tools.build:gradle:7.1.0'
20
21    // Update this line to use 2.4.1
22    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.4.1"
23}
24classpath "com.google.firebase:perf-plugin:1.4.0"
25Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
26    at com.google.firebase.perf.plugin.FirebasePerfClassVisitorFactory.registerForProject(FirebasePerfClassVisitorFactory.java:54)
27    at com.google.firebase.perf.plugin.FirebasePerfPlugin.perform(FirebasePerfPlugin.java:145)
28    at com.google.firebase.perf.plugin.FirebasePerfPlugin.lambda$apply$0(FirebasePerfPlugin.java:107)
29

As per the Firebase Perf Plugin 1.4.1 Release Notes:

Migrated away from the deprecated Android Gradle plugin APIs.

So you should upgrade to 1.4.1:

1Unable to load class 'com.android.build.api.extension.AndroidComponentsExtension'.
2
3This is an unexpected error. Please file a bug containing the idea.log file.
4A problem occurred evaluating project ':main'.
5    at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:103)
6    ...
7Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':main'.
8    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
9    ...
10Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
11    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
12    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
13    ...
14Caused by: java.lang.ClassNotFoundException: com.android.build.api.extension.AndroidComponentsExtension
15Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
16    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:73)
17    at androidx.navigation.safeargs.gradle.SafeArgsPlugin.apply(SafeArgsPlugin.kt:42)
18dependencies {
19    classpath 'com.android.tools.build:gradle:7.1.0'
20
21    // Update this line to use 2.4.1
22    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.4.1"
23}
24classpath "com.google.firebase:perf-plugin:1.4.0"
25Caused by: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension
26    at com.google.firebase.perf.plugin.FirebasePerfClassVisitorFactory.registerForProject(FirebasePerfClassVisitorFactory.java:54)
27    at com.google.firebase.perf.plugin.FirebasePerfPlugin.perform(FirebasePerfPlugin.java:145)
28    at com.google.firebase.perf.plugin.FirebasePerfPlugin.lambda$apply$0(FirebasePerfPlugin.java:107)
29classpath "com.google.firebase:perf-plugin:1.4.1"
30

Source https://stackoverflow.com/questions/70857476

QUESTION

Why Device Manager don't open?

Asked 2022-Mar-07 at 10:23

I'm working on the Flutter project. After I updated the version of the Android Studio when I click on the device manager to open my devices it doesn't show. I don't know what should I do?

At the first image it's gif image to explain what I mean.

enter image description here

I put the second image to show current version (Bumblebee).

enter image description here

ANSWER

Answered 2022-Jan-26 at 14:17

IntelliJ (Android Studio) wants to know what kind of project you have to show the right menus.

  1. click left in file tree on the root node (project name)
  2. MENU -> FILE -> PROJECT STRUCTURE
  3. select left MODULES
  4. hit + button to add ANDROID
  5. hit OK Button
  6. top of the root node (project name) select PROJECT... to see your old view

Source https://stackoverflow.com/questions/70864465

QUESTION

Can't import module in Android Studio Arctic Fox

Asked 2022-Mar-02 at 07:26

Next/Finish button does not become enabled even after selecting the right module path. It does not show any error. Android studio version is 2020.3.1 (Latest as of 3 August, 2021).enter image description here

ANSWER

Answered 2021-Aug-09 at 11:03

I have fund out that it is a bug. Many people are facing the problem using version 2020.3.1. Version 4.2.2 is working well in this case. Here are some links about this bug: https://issuetracker.google.com/issues/195340090 https://issuetracker.google.com/issues/191209456 https://issuetracker.google.com/issues/195318441 https://issuetracker.google.com/issues/195336461

Source https://stackoverflow.com/questions/68636809

QUESTION

Unable to find bundled Java version with flutter doctor, after updating Android studio Arctic Fox(2020.3.1) on M1 Apple Silicon

Asked 2022-Feb-25 at 06:46

I'm facing a weird issue. Before I updated my Android Studio, everything went fine in flutter doctor. Once I've updated Android Studio, when I run the doctor, it's showing "Unable to find bundled Java version". I've already downloaded Java installer and installed it on my M1 Mac, but after I restarted, running flutter doctor still shows the same error. The weird thing is, when I uninstall the Arctic Fox version and re-install the older Android Studio version, everything goes fine again when running the doctor. How can I resolve this?

ANSWER

Answered 2021-Jul-29 at 03:10

COPY folder /Applications/Android Studio Preview.app/Contents/jre/Contents to /Applications/Android Studio Preview.app/Contents/jre/jdk/Contents

Source https://stackoverflow.com/questions/68569430

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Android

Tutorials and Learning Resources are not available at this moment for Android

Share this Page

share link

Get latest updates on Android