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

Popular New Releases in Gradle

tinker

gradle

7.4.2

jib

jib-cli v0.10.0

dex2jar

jsonschema2pojo

1.1.1

Popular Libraries in Gradle

tinker

by Tencent doticonjavadoticon

star image 16260 doticonNOASSERTION

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.

gradle

by gradle doticongroovydoticon

star image 13299 doticonApache-2.0

Adaptable, fast automation for all

jib

by GoogleContainerTools doticonjavadoticon

star image 11721 doticonApache-2.0

🏗 Build container images for your Java applications.

awesome-kotlin

by KotlinBy doticonkotlindoticon

star image 9775 doticonApache-2.0

A curated list of awesome Kotlin related stuff Inspired by awesome-java.

dex2jar

by pxb1988 doticonjavadoticon

star image 9043 doticonApache-2.0

Tools to work with android .dex and java .class files

javapoet

by square doticonjavadoticon

star image 8940 doticonApache-2.0

A Java API for generating .java source files.

Android_Data

by Freelander doticonjavadoticon

star image 8409 doticon

Some Android learning materials, hoping to help you learn Android development.

ndk-samples

by android doticonc++doticon

star image 8125 doticonApache-2.0

Android NDK samples with Android Studio

moshi

by square doticonkotlindoticon

star image 7975 doticonApache-2.0

A modern JSON library for Kotlin and Java.

Trending New libraries in Gradle

ByteX

by bytedance doticonjavadoticon

star image 1948 doticonApache-2.0

ByteX is a bytecode plugin platform based on Android Gradle Transform API and ASM. 字节码插件开发平台

kotlin-android-template

by cortinico doticonkotlindoticon

star image 1330 doticonMIT

Android + Kotlin + Github Actions + ktlint + Detekt + Gradle Kotlin DSL + buildSrc = ❤️

git-notify

by jevakallio doticontypescriptdoticon

star image 1261 doticonMIT

🙉 📣 Communicate important updates to your team via git commit messages

Aliucord

by Aliucord doticonjavadoticon

star image 980 doticonOSL-3.0

A modification for the Discord Android App

ruler

by spotify doticonkotlindoticon

star image 767 doticonApache-2.0

Gradle plugin which helps you analyze the size of your Android apps.

gradle-recipes

by android doticonkotlindoticon

star image 744 doticonApache-2.0

Ready-to-use recipes for common build customizations that showcase the Android Gradle plugin's public APIs and DSL.

themed-toggle-button-group

by Bryanx doticonkotlindoticon

star image 588 doticonMIT

Customisable toggle buttons inside a FlexboxLayout.

dependency-tree-diff

by JakeWharton doticonkotlindoticon

star image 565 doticonApache-2.0

An intelligent diff tool for the output of Gradle's dependencies task

jreleaser

by jreleaser doticonjavadoticon

star image 541 doticonApache-2.0

:rocket: Release projects quickly and easily with JReleaser

Top Authors in Gradle

1

gradle

25 Libraries

star icon18640

2

googleapis

20 Libraries

star icon116

3

melix

19 Libraries

star icon822

4

nebula-plugins

18 Libraries

star icon700

5

bmuschko

17 Libraries

star icon2310

6

palantir

14 Libraries

star icon1365

7

jenkinsci

13 Libraries

star icon577

8

raywenderlich

12 Libraries

star icon106

9

daggerok

12 Libraries

star icon140

10

kousen

12 Libraries

star icon529

1

25 Libraries

star icon18640

2

20 Libraries

star icon116

3

19 Libraries

star icon822

4

18 Libraries

star icon700

5

17 Libraries

star icon2310

6

14 Libraries

star icon1365

7

13 Libraries

star icon577

8

12 Libraries

star icon106

9

12 Libraries

star icon140

10

12 Libraries

star icon529

Trending Kits in Gradle

No Trending Kits are available at this moment for Gradle

Trending Discussions on Gradle

Error: Member not found: 'packageRoot', how to solve ignore: deprecated_member_use in Flutter?

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

Error: MainActivity must extend android.app.Activity [Instantiatable]

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

Java, Intellij IDEA problem Unrecognized option: --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED

Springboot 2.6.0 / Spring fox 3 - Failed to start bean 'documentationPluginsBootstrapper'

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

Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources

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

IntelliJ - Invalid source release: 17

QUESTION

Error: Member not found: 'packageRoot', how to solve ignore: deprecated_member_use in Flutter?

Asked 2022-Apr-05 at 06:52

In my flutter project, I have made some updates of plugins and then used flutter upgrade. After that, whenever I am running my flutter project it is showing following error-

1    /C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.2/lib/src/interface/local_platform.dart:46:19: Error: Member not found: 'packageRoot'.
2          io.Platform.packageRoot; // ignore: deprecated_member_use
3                      ^^^^^^^^^^^ FAILURE: Build failed with an exception.
4
5* Where: Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
6
7* What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
8> Process 'command 'C:\src\flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
9
10* Try: 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.
11
12* Get more help at https://help.gradle.org
13
14BUILD FAILED in 20s Exception: Gradle task assembleDebug failed with exit code 1
15

So, I need a suggestion that how can I solve this issue?

ANSWER

Answered 2021-Dec-16 at 11:49

For me, cleaning and getting the packages didn't work. This error started after I upgraded flutter. I was on the master channel, a quick fix for me was to switch to stable.

1    /C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.2/lib/src/interface/local_platform.dart:46:19: Error: Member not found: 'packageRoot'.
2          io.Platform.packageRoot; // ignore: deprecated_member_use
3                      ^^^^^^^^^^^ FAILURE: Build failed with an exception.
4
5* Where: Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
6
7* What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
8> Process 'command 'C:\src\flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
9
10* Try: 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.
11
12* Get more help at https://help.gradle.org
13
14BUILD FAILED in 20s Exception: Gradle task assembleDebug failed with exit code 1
15flutter channel stable
16flutter upgrade
17

Perhaps theres a better solution which deals with platform package directly.

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

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

Error: MainActivity must extend android.app.Activity [Instantiatable]

Asked 2022-Mar-31 at 02:13

I tried upgrading Android Gradle Plugin from 4.2.2 to 7.0.1 using the upgrade assistant which is available in Android Studio at Tools > AGP Upgrade Assistant. The only change it made was to my project-level build.gradle file:

1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath 'com.android.tools.build:gradle:7.0.1' // changed from 4.2.2 to 7.0.1
8        // ...
9    }
10}
11

However, now when I run ./gradlew assemble assembleAndroidTest I get the following error:

1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath 'com.android.tools.build:gradle:7.0.1' // changed from 4.2.2 to 7.0.1
8        // ...
9    }
10}
11/builds/locuslabs/android-team/locuslabs-android-sdk/app/src/main/AndroidManifest.xml:21: Error: MainActivity must extend android.app.Activity [Instantiatable]
12            android:name="com.locuslabs.appsdk.MainActivity"
13                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14   Explanation for issues of type "Instantiatable":
15   Activities, services, broadcast receivers etc. registered in the manifest
16   file (or for custom views, in a layout file) must be "instantiatable" by
17   the system, which means that the class must be public, it must have an
18   empty public constructor, and if it's an inner class, it must be a static
19   inner class.
201 errors, 0 warnings
21Lint found fatal errors while assembling a release target.
22To proceed, either fix the issues identified by lint, or modify your build script as follows:
23...
24android {
25    lintOptions {
26        checkReleaseBuilds false
27        // Or, if you prefer, you can continue to check for errors in release builds,
28        // but continue the build even when errors are found:
29        abortOnError false
30    }
31}
32

My project is multi-module, but I don't suspect that as the problem since it's complaining about the application module, not a library module.

I believe my <activity> tag is well formed in my AndroidManifest.xml for my application module:

1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath 'com.android.tools.build:gradle:7.0.1' // changed from 4.2.2 to 7.0.1
8        // ...
9    }
10}
11/builds/locuslabs/android-team/locuslabs-android-sdk/app/src/main/AndroidManifest.xml:21: Error: MainActivity must extend android.app.Activity [Instantiatable]
12            android:name=&quot;com.locuslabs.appsdk.MainActivity&quot;
13                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14   Explanation for issues of type &quot;Instantiatable&quot;:
15   Activities, services, broadcast receivers etc. registered in the manifest
16   file (or for custom views, in a layout file) must be &quot;instantiatable&quot; by
17   the system, which means that the class must be public, it must have an
18   empty public constructor, and if it's an inner class, it must be a static
19   inner class.
201 errors, 0 warnings
21Lint found fatal errors while assembling a release target.
22To proceed, either fix the issues identified by lint, or modify your build script as follows:
23...
24android {
25    lintOptions {
26        checkReleaseBuilds false
27        // Or, if you prefer, you can continue to check for errors in release builds,
28        // but continue the build even when errors are found:
29        abortOnError false
30    }
31}
32        &lt;activity
33            android:name=&quot;com.locuslabs.appsdk.MainActivity&quot;
34            android:label=&quot;@string/app_name&quot;
35            android:windowSoftInputMode=&quot;adjustNothing&quot;&gt;
36            &lt;intent-filter&gt;
37                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
38
39                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
40            &lt;/intent-filter&gt;
41        &lt;/activity&gt;
42

Furthermore, I don't think there is anything wrong with extending AppCompatActivity instead of android.app.Activity as I'm doing in my MainActivity.kt:

1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath 'com.android.tools.build:gradle:7.0.1' // changed from 4.2.2 to 7.0.1
8        // ...
9    }
10}
11/builds/locuslabs/android-team/locuslabs-android-sdk/app/src/main/AndroidManifest.xml:21: Error: MainActivity must extend android.app.Activity [Instantiatable]
12            android:name=&quot;com.locuslabs.appsdk.MainActivity&quot;
13                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14   Explanation for issues of type &quot;Instantiatable&quot;:
15   Activities, services, broadcast receivers etc. registered in the manifest
16   file (or for custom views, in a layout file) must be &quot;instantiatable&quot; by
17   the system, which means that the class must be public, it must have an
18   empty public constructor, and if it's an inner class, it must be a static
19   inner class.
201 errors, 0 warnings
21Lint found fatal errors while assembling a release target.
22To proceed, either fix the issues identified by lint, or modify your build script as follows:
23...
24android {
25    lintOptions {
26        checkReleaseBuilds false
27        // Or, if you prefer, you can continue to check for errors in release builds,
28        // but continue the build even when errors are found:
29        abortOnError false
30    }
31}
32        &lt;activity
33            android:name=&quot;com.locuslabs.appsdk.MainActivity&quot;
34            android:label=&quot;@string/app_name&quot;
35            android:windowSoftInputMode=&quot;adjustNothing&quot;&gt;
36            &lt;intent-filter&gt;
37                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
38
39                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
40            &lt;/intent-filter&gt;
41        &lt;/activity&gt;
42import androidx.appcompat.app.AppCompatActivity
43
44class MainActivity : AppCompatActivity() {
45    // ...
46}
47

I'm concerned that Android Gradle Plugin 7.0.1 is not really ready for prime-time because the Android Gradle Plugin documentation still says classpath 'com.android.tools.build:gradle:4.2.0' instead of 7.0.1.

I saw that the Android Gradle Plugin 7.0.1 release notes mentioned some changes to linting but none of those changes seemed relevant to me.

I also skimmed through the Android Gradle Plugin source code to see if I could find the linting stage any identify any changes but it looked like a lot of work to find that code and do that analysis.

I searched for answers but all I could find were these two stackoverflow entries where the error was legitimate and the programmer just needed to change their code to ensure they were referencing an actual Activity:

  1. Android Studio Error: Activity must extend android.app.activity
  2. MainActivity cannot be cast to android.app.Activity

I also tried Android Gradle Plugin 7.0.0 but got the same error. Only Android Gradle Plugin 4.2.2 prevents the error.

Is this a bug in Android Gradle Plugin 7.0.1?

Update: could not disable Instantiatable

I tried to disable the Instantiatable lint error the following ways but none of them prevented the error.

First, I tried adding disable "Instantiatable" to my application-level build.gradle file:

1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath 'com.android.tools.build:gradle:7.0.1' // changed from 4.2.2 to 7.0.1
8        // ...
9    }
10}
11/builds/locuslabs/android-team/locuslabs-android-sdk/app/src/main/AndroidManifest.xml:21: Error: MainActivity must extend android.app.Activity [Instantiatable]
12            android:name=&quot;com.locuslabs.appsdk.MainActivity&quot;
13                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14   Explanation for issues of type &quot;Instantiatable&quot;:
15   Activities, services, broadcast receivers etc. registered in the manifest
16   file (or for custom views, in a layout file) must be &quot;instantiatable&quot; by
17   the system, which means that the class must be public, it must have an
18   empty public constructor, and if it's an inner class, it must be a static
19   inner class.
201 errors, 0 warnings
21Lint found fatal errors while assembling a release target.
22To proceed, either fix the issues identified by lint, or modify your build script as follows:
23...
24android {
25    lintOptions {
26        checkReleaseBuilds false
27        // Or, if you prefer, you can continue to check for errors in release builds,
28        // but continue the build even when errors are found:
29        abortOnError false
30    }
31}
32        &lt;activity
33            android:name=&quot;com.locuslabs.appsdk.MainActivity&quot;
34            android:label=&quot;@string/app_name&quot;
35            android:windowSoftInputMode=&quot;adjustNothing&quot;&gt;
36            &lt;intent-filter&gt;
37                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
38
39                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
40            &lt;/intent-filter&gt;
41        &lt;/activity&gt;
42import androidx.appcompat.app.AppCompatActivity
43
44class MainActivity : AppCompatActivity() {
45    // ...
46}
47android {
48    lintOptions {
49        disable &quot;Instantiatable&quot;
50    }
51}
52

Second, I tried prepending @SdkSuppress("Instantiatable") to the class:

1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath 'com.android.tools.build:gradle:7.0.1' // changed from 4.2.2 to 7.0.1
8        // ...
9    }
10}
11/builds/locuslabs/android-team/locuslabs-android-sdk/app/src/main/AndroidManifest.xml:21: Error: MainActivity must extend android.app.Activity [Instantiatable]
12            android:name=&quot;com.locuslabs.appsdk.MainActivity&quot;
13                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14   Explanation for issues of type &quot;Instantiatable&quot;:
15   Activities, services, broadcast receivers etc. registered in the manifest
16   file (or for custom views, in a layout file) must be &quot;instantiatable&quot; by
17   the system, which means that the class must be public, it must have an
18   empty public constructor, and if it's an inner class, it must be a static
19   inner class.
201 errors, 0 warnings
21Lint found fatal errors while assembling a release target.
22To proceed, either fix the issues identified by lint, or modify your build script as follows:
23...
24android {
25    lintOptions {
26        checkReleaseBuilds false
27        // Or, if you prefer, you can continue to check for errors in release builds,
28        // but continue the build even when errors are found:
29        abortOnError false
30    }
31}
32        &lt;activity
33            android:name=&quot;com.locuslabs.appsdk.MainActivity&quot;
34            android:label=&quot;@string/app_name&quot;
35            android:windowSoftInputMode=&quot;adjustNothing&quot;&gt;
36            &lt;intent-filter&gt;
37                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
38
39                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
40            &lt;/intent-filter&gt;
41        &lt;/activity&gt;
42import androidx.appcompat.app.AppCompatActivity
43
44class MainActivity : AppCompatActivity() {
45    // ...
46}
47android {
48    lintOptions {
49        disable &quot;Instantiatable&quot;
50    }
51}
52@SdkSuppress(&quot;Instantiatable&quot;)
53class MainActivity : AppCompatActivity() {
54   // ...
55}
56

Similarly, I tried @SuppressLint("Instantiatable") but that didn't work either.

ANSWER

Answered 2021-Aug-24 at 16:35

the Android Gradle Plugin documentation still says classpath 'com.android.tools.build:gradle:4.2.0' instead of 7.0.1.

You need to read further down the page, to this and this. That table is only relevant for pre-7.0.0 versions.

Is this a bug in Android Gradle Plugin 7.0.1?

Quite possibly. Or, perhaps beyond, as the Instantiatable Lint check has a history of problems.

If your scenario does not match one of those three August 2021 bugs, and you are in position to provide a reproducible test case, file a fresh issue! Beyond that, if a clean-and-rebuild is not clearing up your problem, you might need to simply disable the Instantiatable Lint check for the time being by adding the following to all of your build.gradle files at the application or library level (i.e. all except your project-level build.gradle):

1buildscript {
2    repositories {
3        google()
4        mavenCentral()
5    }
6    dependencies {
7        classpath 'com.android.tools.build:gradle:7.0.1' // changed from 4.2.2 to 7.0.1
8        // ...
9    }
10}
11/builds/locuslabs/android-team/locuslabs-android-sdk/app/src/main/AndroidManifest.xml:21: Error: MainActivity must extend android.app.Activity [Instantiatable]
12            android:name=&quot;com.locuslabs.appsdk.MainActivity&quot;
13                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14   Explanation for issues of type &quot;Instantiatable&quot;:
15   Activities, services, broadcast receivers etc. registered in the manifest
16   file (or for custom views, in a layout file) must be &quot;instantiatable&quot; by
17   the system, which means that the class must be public, it must have an
18   empty public constructor, and if it's an inner class, it must be a static
19   inner class.
201 errors, 0 warnings
21Lint found fatal errors while assembling a release target.
22To proceed, either fix the issues identified by lint, or modify your build script as follows:
23...
24android {
25    lintOptions {
26        checkReleaseBuilds false
27        // Or, if you prefer, you can continue to check for errors in release builds,
28        // but continue the build even when errors are found:
29        abortOnError false
30    }
31}
32        &lt;activity
33            android:name=&quot;com.locuslabs.appsdk.MainActivity&quot;
34            android:label=&quot;@string/app_name&quot;
35            android:windowSoftInputMode=&quot;adjustNothing&quot;&gt;
36            &lt;intent-filter&gt;
37                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
38
39                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
40            &lt;/intent-filter&gt;
41        &lt;/activity&gt;
42import androidx.appcompat.app.AppCompatActivity
43
44class MainActivity : AppCompatActivity() {
45    // ...
46}
47android {
48    lintOptions {
49        disable &quot;Instantiatable&quot;
50    }
51}
52@SdkSuppress(&quot;Instantiatable&quot;)
53class MainActivity : AppCompatActivity() {
54   // ...
55}
56android {
57    lintOptions {
58        disable &quot;Instantiatable&quot;
59    }
60}
61

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

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 = &quot;${rootProject.buildDir}/${project.name}&quot;
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 = &quot;${rootProject.buildDir}/${project.name}&quot;
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 = &quot;${rootProject.buildDir}/${project.name}&quot;
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

Java, Intellij IDEA problem Unrecognized option: --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED

Asked 2022-Mar-26 at 15:23

I have newly installed

1IntelliJ IDEA 2021.2 (Ultimate Edition)
2Build #IU-212.4746.92, built on July 27, 2021
3Licensed to XXXXXX
4Subscription is active until August 15, 2021.
5Runtime version: 11.0.11+9-b1504.13 amd64
6VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
7Linux 5.4.0-80-generic
8GC: G1 Young Generation, G1 Old Generation
9Memory: 2048M
10Cores: 3
11
12Kotlin: 212-1.5.10-release-IJ4746.92
13Current Desktop: X-Cinnamon
14

I cloned project I work with on other workstation without issues, but cannot start any class with main method and IDEA says:

1IntelliJ IDEA 2021.2 (Ultimate Edition)
2Build #IU-212.4746.92, built on July 27, 2021
3Licensed to XXXXXX
4Subscription is active until August 15, 2021.
5Runtime version: 11.0.11+9-b1504.13 amd64
6VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
7Linux 5.4.0-80-generic
8GC: G1 Young Generation, G1 Old Generation
9Memory: 2048M
10Cores: 3
11
12Kotlin: 212-1.5.10-release-IJ4746.92
13Current Desktop: X-Cinnamon
14Abnormal build process termination: 
15/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -Xmx700m -Djava.awt.headless=true -Djava.endorsed.dirs=\&quot;\&quot; -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djdt.compiler.useSingleThread=true -Daether.connector.resumeDownloads=false -Dio.netty.initialSeedUniquifier=-5972351880001011455 -Dfile.encoding=UTF-8 -Duser.language=en -Duser.country=US -Didea.paths.selector=IntelliJIdea2021.2 -Didea.home.path=/home/pm/idea-IU-212.4746.92 -Didea.config.path=/home/pm/.config/JetBrains/IntelliJIdea2021.2 -Didea.plugins.path=/home/pm/.local/share/JetBrains/IntelliJIdea2021.2 -Djps.log.dir=/home/pm/.cache/JetBrains/IntelliJIdea2021.2/log/build-log -Djps.fallback.jdk.home=/home/pm/idea-IU-212.4746.92/jbr -Djps.fallback.jdk.version=11.0.11 -Dio.netty.noUnsafe=true -Djava.io.tmpdir=/home/pm/.cache/JetBrains/IntelliJIdea2021.2/compile-server/rfg-survey-api_cc70fc05/_temp_ -Djps.backward.ref.index.builder=true -Djps.track.ap.dependencies=false --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -Dtmh.instrument.annotations=true -Dtmh.generate.line.numbers=true -Dkotlin.incremental.compilation=true -Dkotlin.incremental.compilation.js=true -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path=\&quot;/tmp/kotlin-idea-12426594439704512301-is-running\&quot; -classpath /home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-launcher.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/lib/tools.jar org.jetbrains.jps.cmdline.Launcher /home/pm/idea-IU-212.4746.92/lib/slf4j.jar:/home/pm/idea-IU-212.4746.92/lib/idea_rt.jar:/home/pm/idea-IU-212.4746.92/lib/platform-api.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/maven-resolver-transport-file-1.3.3.jar:/home/pm/idea-IU-212.4746.92/lib/forms_rt.jar:/home/pm/idea-IU-212.4746.92/lib/util.jar:/home/pm/idea-IU-212.4746.92/lib/annotations.jar:/home/pm/idea-IU-212.4746.92/lib/3rd-party.jar:/home/pm/idea-IU-212.4746.92/lib/kotlin-stdlib-jdk8.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/maven-resolver-connector-basic-1.3.3.jar:/home/pm/idea-IU-212.4746.92/lib/jna-platform.jar:/home/pm/idea-IU-212.4746.92/lib/protobuf-java-3.15.8.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-builders-6.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/javac2.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/aether-dependency-resolver.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-builders.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/jps-javac-extension-1.jar:/home/pm/idea-IU-212.4746.92/lib/jna.jar:/home/pm/idea-IU-212.4746.92/lib/jps-model.jar:/home/pm/idea-IU-212.4746.92/plugins/java/lib/maven-resolver-transport-http-1.3.3.jar:/home/pm/idea-IU-212.4746.92/plugins/JavaEE/lib/jasper-v2-rt.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-reflect.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-plugin.jar:/home/pm/idea-IU-212.4746.92/plugins/ant/lib/ant-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/uiDesigner/lib/jps/java-guiForms-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/eclipse/lib/eclipse-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/eclipse/lib/eclipse-common.jar:/home/pm/idea-IU-212.4746.92/plugins/IntelliLang/lib/java-langInjection-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Groovy/lib/groovy-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Groovy/lib/groovy-constants-rt.jar:/home/pm/idea-IU-212.4746.92/plugins/maven/lib/maven-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/gradle-java/lib/gradle-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/devkit/lib/devkit-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/javaFX/lib/javaFX-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/javaFX/lib/javaFX-common.jar:/home/pm/idea-IU-212.4746.92/plugins/JavaEE/lib/javaee-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/webSphereIntegration/lib/jps/javaee-appServers-websphere-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/weblogicIntegration/lib/jps/javaee-appServers-weblogic-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/JPA/lib/jps/javaee-jpa-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Grails/lib/groovy-grails-jps.jar:/home/pm/idea-IU-212.4746.92/plugins/Grails/lib/groovy-grails-compilerPatch.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/jps/kotlin-jps-plugin.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-jps-common.jar:/home/pm/idea-IU-212.4746.92/plugins/Kotlin/lib/kotlin-common.jar org.jetbrains.jps.cmdline.BuildMain 127.0.0.1 34781 9f0681bb-da2a-48db-8344-900ddeb29804 /home/pm/.cache/JetBrains/IntelliJIdea2021.2/compile-server
16Unrecognized option: --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
17Error: Could not create the Java Virtual Machine.
18Error: A fatal exception has occurred. Program will exit.
19

I found other comment to check Lombok works and I see it is fine.

How to fix the problem?

ANSWER

Answered 2021-Jul-28 at 07:22

You are running the project via Java 1.8 and add the --add-opens option to the runner. However Java 1.8 does not support it.

So, the first option is to use Java 11 to run the project, as Java 11 can recognize this VM option.

Another solution is to find a place where --add-opens is added and remove it. Check Run configuration in IntelliJ IDEA (VM options field) and Maven/Gradle configuration files for argLine (Maven) and jvmArgs (Gradle)

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

QUESTION

Springboot 2.6.0 / Spring fox 3 - Failed to start bean 'documentationPluginsBootstrapper'

Asked 2022-Mar-25 at 06:14

I'm trying to initiate a Springboot project using Open Jdk 15, Springboot 2.6.0, Springfox 3. We are working on a project that replaced Netty as the webserver and used Jetty instead because we do not need a non-blocking environment.

In the code we depend primarily on Reactor API (Flux, Mono), so we can not remove org.springframework.boot:spring-boot-starter-webflux dependencies.

I replicated the problem that we have in a new project.: https://github.com/jvacaq/spring-fox.

I figured out that these lines in our build.gradle file are the origin of the problem.

1compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;) {
2   exclude module: &quot;spring-boot-starter-tomcat&quot;
3}
4compile(&quot;org.springframework.boot:spring-boot-starter-jetty&quot;)
5

Here is the build.gradle file:

1compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;) {
2   exclude module: &quot;spring-boot-starter-tomcat&quot;
3}
4compile(&quot;org.springframework.boot:spring-boot-starter-jetty&quot;)
5plugins {
6    id 'org.springframework.boot' version '2.6.0'
7    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
8    id 'java'
9}
10
11group = 'com.example'
12version = '0.0.1-SNAPSHOT'
13sourceCompatibility = '11'
14
15repositories {
16    mavenCentral()
17}
18
19dependencies {
20    compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;) {
21        exclude module: &quot;spring-boot-starter-tomcat&quot;
22    }
23    compile(&quot;org.springframework.boot:spring-boot-starter-jetty&quot;)
24    implementation 'org.springframework.boot:spring-boot-starter-webflux'
25    testImplementation 'org.springframework.boot:spring-boot-starter-test'
26    testImplementation 'io.projectreactor:reactor-test'
27    implementation &quot;io.springfox:springfox-boot-starter:3.0.0&quot;
28}
29
30test {
31    useJUnitPlatform()
32}
33
34

I issued the command gradle clean bootrun. The result is this error:

1compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;) {
2   exclude module: &quot;spring-boot-starter-tomcat&quot;
3}
4compile(&quot;org.springframework.boot:spring-boot-starter-jetty&quot;)
5plugins {
6    id 'org.springframework.boot' version '2.6.0'
7    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
8    id 'java'
9}
10
11group = 'com.example'
12version = '0.0.1-SNAPSHOT'
13sourceCompatibility = '11'
14
15repositories {
16    mavenCentral()
17}
18
19dependencies {
20    compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;) {
21        exclude module: &quot;spring-boot-starter-tomcat&quot;
22    }
23    compile(&quot;org.springframework.boot:spring-boot-starter-jetty&quot;)
24    implementation 'org.springframework.boot:spring-boot-starter-webflux'
25    testImplementation 'org.springframework.boot:spring-boot-starter-test'
26    testImplementation 'io.projectreactor:reactor-test'
27    implementation &quot;io.springfox:springfox-boot-starter:3.0.0&quot;
28}
29
30test {
31    useJUnitPlatform()
32}
33
34 gradle clean bootrun                                                                                                                                                                                                               
35
36&gt; Task :bootRun FAILED
37
38  .   ____          _            __ _ _
39 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
40( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
41 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
42  '  |____| .__|_| |_|_| |_\__, | / / / /
43 =========|_|==============|___/=/_/_/_/
44 :: Spring Boot ::                (v2.6.0)
45
462021-11-19 09:41:06.665  INFO 16666 --- [           main] c.e.springfox.SpringFoxApplication       : Starting SpringFoxApplication using Java 15.0.2 on advance-Inspiron-5379 with PID 16666 (/home/advance/projects/spring-fox/build/classes/java/main started by advance in /home/advance/projects/spring-fox)
472021-11-19 09:41:06.666  INFO 16666 --- [           main] c.e.springfox.SpringFoxApplication       : No active profile set, falling back to default profiles: default
482021-11-19 09:41:07.294  INFO 16666 --- [           main] org.eclipse.jetty.util.log               : Logging initialized @1132ms to org.eclipse.jetty.util.log.Slf4jLog
492021-11-19 09:41:07.396  INFO 16666 --- [           main] o.s.b.w.e.j.JettyServletWebServerFactory : Server initialized with port: 8080
502021-11-19 09:41:07.398  INFO 16666 --- [           main] org.eclipse.jetty.server.Server          : jetty-9.4.44.v20210927; built: 2021-09-27T23:02:44.612Z; git: 8da83308eeca865e495e53ef315a249d63ba9332; jvm 15.0.2+7-27
512021-11-19 09:41:07.417  INFO 16666 --- [           main] o.e.j.s.h.ContextHandler.application     : Initializing Spring embedded WebApplicationContext
522021-11-19 09:41:07.417  INFO 16666 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 713 ms
532021-11-19 09:41:07.474  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : DefaultSessionIdManager workerName=node0
542021-11-19 09:41:07.474  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : No SessionScavenger set, using defaults
552021-11-19 09:41:07.475  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : node0 Scavenging every 660000ms
562021-11-19 09:41:07.480  INFO 16666 --- [           main] o.e.jetty.server.handler.ContextHandler  : Started o.s.b.w.e.j.JettyEmbeddedWebAppContext@6aa3bfc{application,/,[file:///tmp/jetty-docbase.8080.2024342829220941812/, jar:file:/home/advance/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/3.0.0/1e665fbe22148f7c36fa8a08e515a0047cd4390b/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],AVAILABLE}
572021-11-19 09:41:07.480  INFO 16666 --- [           main] org.eclipse.jetty.server.Server          : Started @1318ms
582021-11-19 09:41:07.920  INFO 16666 --- [           main] o.e.j.s.h.ContextHandler.application     : Initializing Spring DispatcherServlet 'dispatcherServlet'
592021-11-19 09:41:07.920  INFO 16666 --- [           main] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
602021-11-19 09:41:07.921  INFO 16666 --- [           main] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
612021-11-19 09:41:07.931  INFO 16666 --- [           main] o.e.jetty.server.AbstractConnector       : Started ServerConnector@2643d762{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
622021-11-19 09:41:07.932  INFO 16666 --- [           main] o.s.b.web.embedded.jetty.JettyWebServer  : Jetty started on port(s) 8080 (http/1.1) with context path '/'
632021-11-19 09:41:07.934  WARN 16666 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException: Cannot invoke &quot;org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()&quot; because &quot;this.condition&quot; is null
642021-11-19 09:41:07.949  INFO 16666 --- [           main] o.e.jetty.server.AbstractConnector       : Stopped ServerConnector@2643d762{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
652021-11-19 09:41:07.950  INFO 16666 --- [           main] org.eclipse.jetty.server.session         : node0 Stopped scavenging
662021-11-19 09:41:07.951  INFO 16666 --- [           main] o.e.j.s.h.ContextHandler.application     : Destroying Spring FrameworkServlet 'dispatcherServlet'
672021-11-19 09:41:07.951  INFO 16666 --- [           main] o.e.jetty.server.handler.ContextHandler  : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@6aa3bfc{application,/,[file:///tmp/jetty-docbase.8080.2024342829220941812/, jar:file:/home/advance/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/3.0.0/1e665fbe22148f7c36fa8a08e515a0047cd4390b/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],STOPPED}
682021-11-19 09:41:07.958  INFO 16666 --- [           main] ConditionEvaluationReportLoggingListener : 
69
70Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
712021-11-19 09:41:07.970 ERROR 16666 --- [           main] o.s.boot.SpringApplication               : Application run failed
72
73org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException: Cannot invoke &quot;org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()&quot; because &quot;this.condition&quot; is null
74        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.13.jar:5.3.13]
75        at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.13.jar:5.3.13]
76        at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.13.jar:5.3.13]
77        at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
78        at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.13.jar:5.3.13]
79        at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.13.jar:5.3.13]
80        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.13.jar:5.3.13]
81        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.13.jar:5.3.13]
82        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.0.jar:2.6.0]
83        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-2.6.0.jar:2.6.0]
84        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[spring-boot-2.6.0.jar:2.6.0]
85        at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[spring-boot-2.6.0.jar:2.6.0]
86        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.0.jar:2.6.0]
87        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) ~[spring-boot-2.6.0.jar:2.6.0]
88        at com.example.springfox.SpringFoxApplication.main(SpringFoxApplication.java:10) ~[main/:na]
89Caused by: java.lang.NullPointerException: Cannot invoke &quot;org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()&quot; because &quot;this.condition&quot; is null
90        at springfox.documentation.spring.web.WebMvcPatternsRequestConditionWrapper.getPatterns(WebMvcPatternsRequestConditionWrapper.java:56) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
91        at springfox.documentation.RequestHandler.sortedPaths(RequestHandler.java:113) ~[springfox-core-3.0.0.jar:3.0.0]
92        at springfox.documentation.spi.service.contexts.Orderings.lambda$byPatternsCondition$3(Orderings.java:89) ~[springfox-spi-3.0.0.jar:3.0.0]
93        at java.base/java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:469) ~[na:na]
94        at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[na:na]
95        at java.base/java.util.TimSort.sort(TimSort.java:220) ~[na:na]
96        at java.base/java.util.Arrays.sort(Arrays.java:1306) ~[na:na]
97        at java.base/java.util.ArrayList.sort(ArrayList.java:1721) ~[na:na]
98        at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:392) ~[na:na]
99        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
100        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
101        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
102        at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) ~[na:na]
103        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) ~[na:na]
104        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
105        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
106        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
107        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
108        at springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(WebMvcRequestHandlerProvider.java:81) ~[springfox-spring-webmvc-3.0.0.jar:3.0.0]
109        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
110        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na]
111        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
112        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
113        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
114        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
115        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
116        at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.withDefaults(AbstractDocumentationPluginsBootstrapper.java:107) ~[springfox-spring-web-3.0.0.jar:3.0.0]
117        at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.buildContext(AbstractDocumentationPluginsBootstrapper.java:91) ~[springfox-spring-web-3.0.0.jar:3.0.0]
118        at springfox.documentation.spring.web.plugins.AbstractDocumentationPluginsBootstrapper.bootstrapDocumentationPlugins(AbstractDocumentationPluginsBootstrapper.java:82) ~[springfox-spring-web-3.0.0.jar:3.0.0]
119        at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:100) ~[springfox-spring-web-3.0.0.jar:3.0.0]
120        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.13.jar:5.3.13]
121        ... 14 common frames omitted
122
123
124FAILURE: Build failed with an exception.
125
126* What went wrong:
127Execution failed for task ':bootRun'.
128&gt; Process 'command '/home/advance/.sdkman/candidates/java/15.0.2-open/bin/java'' finished with non-zero exit value 1
129
130* Try:
131Run 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.
132
133* Get more help at https://help.gradle.org
134
135Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
136Use '--warning-mode all' to show the individual deprecation warnings.
137See https://docs.gradle.org/6.9.1/userguide/command_line_interface.html#sec:command_line_warnings
138
139BUILD FAILED in 2s
1405 actionable tasks: 5 executed
141

Does anyone have an idea how to solve it?

ANSWER

Answered 2022-Feb-08 at 12:36

This problem's caused by a bug in Springfox. It's making an assumption about how Spring MVC is set up that doesn't always hold true. Specifically, it's assuming that MVC's path matching will use the Ant-based path matcher and not the PathPattern-based matcher. PathPattern-based matching has been an option for some time now and is the default as of Spring Boot 2.6.

As described in Spring Boot 2.6's release notes, you can restore the configuration that Springfox assumes will be used by setting spring.mvc.pathmatch.matching-strategy to ant-path-matcher in your application.properties file. Note that this will only work if you are not using Spring Boot's Actuator. The Actuator always uses PathPattern-based parsing, irrespective of the configured matching-strategy. A change to Springfox will be required if you want to use it with the Actuator in Spring Boot 2.6 and later.

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

QUESTION

Message &quot;error: resource android:attr/lStar not found&quot;

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

Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources

Asked 2022-Mar-22 at 16:46

I get the following warning when I want to use @AndroidEntryPoint which is a property of hilt in my project.

1 Expected @AndroidEntryPoint to have a value. Did you forget to apply the Gradle Plugin? (dagger.hilt.android.plugin)
2

When I try to add id 'dagger.hilt.android.plugin' to the module level build.gradle file of my project, I get the following error.

1 Expected @AndroidEntryPoint to have a value. Did you forget to apply the Gradle Plugin? (dagger.hilt.android.plugin)
2org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources:
3

I tried to add it to the build.gradle file at the Module level of the project as follows. They all give an error.

enter image description here

I tried to add it as a classpath to the project level build.gradle file, in this case I still get an error.

enter image description here

When I created the default project, a settings.gradle structure was created as follows. This is my first time using this build. My version of Android Studio Android Studio - Bumblebee | 2021.1.1 Canary 13

enter image description here

ANSWER

Answered 2021-Oct-10 at 08:39

For adding dagger hilt to your project. Follow these steps

Add hilt dependencies to your module's build.gradle. I assume you are using Kotlin, otherwise you have to use annotationProcessor insted of kapt plugin.

1 Expected @AndroidEntryPoint to have a value. Did you forget to apply the Gradle Plugin? (dagger.hilt.android.plugin)
2org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources:
3dependencies {
4  //..
5  implementation 'com.google.dagger:hilt-android:2.39.1'
6  kapt 'com.google.dagger:hilt-compiler:2.39.1'
7  //..
8   }
9

Add hilt gradle plugin to project's build.gradle.

1 Expected @AndroidEntryPoint to have a value. Did you forget to apply the Gradle Plugin? (dagger.hilt.android.plugin)
2org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources:
3dependencies {
4  //..
5  implementation 'com.google.dagger:hilt-android:2.39.1'
6  kapt 'com.google.dagger:hilt-compiler:2.39.1'
7  //..
8   }
9dependencies {
10    //..
11    classpath 'com.google.dagger:hilt-android-gradle-plugin:2.39.1'
12  }
13

Apply kotlin-kapt and hilt plugins to module build.gradle

1 Expected @AndroidEntryPoint to have a value. Did you forget to apply the Gradle Plugin? (dagger.hilt.android.plugin)
2org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources:
3dependencies {
4  //..
5  implementation 'com.google.dagger:hilt-android:2.39.1'
6  kapt 'com.google.dagger:hilt-compiler:2.39.1'
7  //..
8   }
9dependencies {
10    //..
11    classpath 'com.google.dagger:hilt-android-gradle-plugin:2.39.1'
12  }
13plugins {
14    id 'kotlin-kapt'
15    id 'dagger.hilt.android.plugin'
16}
17

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

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 -&gt;
5        localProperties.load(reader)
6    }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11    throw new GradleException(&quot;Flutter SDK not found. Define location with flutter.sdk in the local.properties file.&quot;)
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: &quot;$flutterRoot/packages/flutter_tools/gradle/flutter.gradle&quot;
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 &quot;*********&quot;
48        minSdkVersion 30
49        targetSdkVersion 30
50        versionCode flutterVersionCode.toInteger()
51        versionName flutterVersionName
52        testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
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 &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;
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 -&gt;
5        localProperties.load(reader)
6    }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11    throw new GradleException(&quot;Flutter SDK not found. Define location with flutter.sdk in the local.properties file.&quot;)
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: &quot;$flutterRoot/packages/flutter_tools/gradle/flutter.gradle&quot;
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 &quot;*********&quot;
48        minSdkVersion 30
49        targetSdkVersion 30
50        versionCode flutterVersionCode.toInteger()
51        versionName flutterVersionName
52        testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
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 &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;
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 = '&lt;latest-version&gt;'
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 -&gt;
5        localProperties.load(reader)
6    }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11    throw new GradleException(&quot;Flutter SDK not found. Define location with flutter.sdk in the local.properties file.&quot;)
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: &quot;$flutterRoot/packages/flutter_tools/gradle/flutter.gradle&quot;
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 &quot;*********&quot;
48        minSdkVersion 30
49        targetSdkVersion 30
50        versionCode flutterVersionCode.toInteger()
51        versionName flutterVersionName
52        testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
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 &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;
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 = '&lt;latest-version&gt;'
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 -&gt;
5        localProperties.load(reader)
6    }
7}
8
9def flutterRoot = localProperties.getProperty('flutter.sdk')
10if (flutterRoot == null) {
11    throw new GradleException(&quot;Flutter SDK not found. Define location with flutter.sdk in the local.properties file.&quot;)
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: &quot;$flutterRoot/packages/flutter_tools/gradle/flutter.gradle&quot;
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 &quot;*********&quot;
48        minSdkVersion 30
49        targetSdkVersion 30
50        versionCode flutterVersionCode.toInteger()
51        versionName flutterVersionName
52        testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
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 &quot;org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version&quot;
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 = '&lt;latest-version&gt;'
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

IntelliJ - Invalid source release: 17

Asked 2022-Mar-17 at 13:46

I've created a new Java project in IntelliJ with Gradle that uses Java 17. When running my app it has the error Cause: error: invalid source release: 17.

My Settings

I've installed openjdk-17 through IntelliJ and set it as my Project SDK.

The Project language level has been set to 17 - Sealed types, always-strict floating-point semantics.

enter image description here

In Modules -> Sources I've set the Language level to Project default (17 - Sealed types, always strict floating-point semantics).

modules->sources

In Modules -> Dependencies I've set the Module SDK to Project SDK openjdk-17.

modules->dependencies

In Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler I've set the Project bytecode version to 17.

enter image description here

Gradle

1plugins {
2    id 'org.springframework.boot' version '2.5.6'
3    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
4    id 'java'
5}
6
7group = 'com.app'
8version = '0.0.1-SNAPSHOT'
9sourceCompatibility = '17'
10
11repositories {
12    mavenCentral()
13}
14
15dependencies {
16    implementation 'org.springframework.boot:spring-boot-starter-web'
17    implementation 'org.springframework.boot:spring-boot-starter-websocket'
18    testImplementation 'org.springframework.boot:spring-boot-starter-test'
19    implementation 'com.fasterxml.jackson.core:jackson-core:2.13.0'
20    implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
21}
22
23test {
24    useJUnitPlatform()
25}
26

I've looked at all of the answers here but I can't seem to fix this. I must be missing something but I can't find it. I've not had any problems using Java 8 or 11.

How do I resolve this?

ANSWER

Answered 2021-Oct-24 at 14:23

The message typically entails that your JAVA_HOME environment variable points to a different Java version.

Here are the steps to follow:

  • Close IntelliJ IDEA
  • Open a terminal window and check your JAVA_HOME variable value:
    • *nix system: echo $JAVA_HOME
    • Windows system: echo %JAVA_HOME%
  • The JAVA_HOME path should be pointing to a different path, then set it to the openjdk-17 path:
    • *nix system: export JAVA_HOME=/path/to/openjdk-17
    • Windows system: set JAVA_HOME=path\to\openjdk-17
  • Open your project again in IntelliJ IDEA
  • Make sure to set both source and target compatibility versions (not only the sourceCompatibility)

You should be able to build your project.

EDIT: Gradle Toolchain

You may need also to instruct Gradle to use a different JVM than the one it uses itself by setting the Java plugin toolchain to your target version:

1plugins {
2    id 'org.springframework.boot' version '2.5.6'
3    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
4    id 'java'
5}
6
7group = 'com.app'
8version = '0.0.1-SNAPSHOT'
9sourceCompatibility = '17'
10
11repositories {
12    mavenCentral()
13}
14
15dependencies {
16    implementation 'org.springframework.boot:spring-boot-starter-web'
17    implementation 'org.springframework.boot:spring-boot-starter-websocket'
18    testImplementation 'org.springframework.boot:spring-boot-starter-test'
19    implementation 'com.fasterxml.jackson.core:jackson-core:2.13.0'
20    implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
21}
22
23test {
24    useJUnitPlatform()
25}
26// build.gradle
27java {
28    toolchain {
29        languageVersion = JavaLanguageVersion.of(17)
30    }
31}
32

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

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Gradle

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

Share this Page

share link

Get latest updates on Gradle