firebase_analytics-9.3.3 and firebase_auth-3.7.0 showing "unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details." - firebase-authentication

About
Creating a flutter application, where I have updated
flutter SDK,
required packages in pubspec.yaml to the latest version, and
changes made to the android>app>build.gradle file
minSdkVersion 23
After performing all the steps mentioned above, I executed 3 commands...
flutter clean
flutter pub get
flutter run
And ultimately I am getting these Notes...
Note: I:\projects\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_analytics-9.3.3\android\src\main\java\io\flutter\plugins\firebase\analytics\FlutterFirebaseAnalyticsPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: I:\projects\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-3.7.0\android\src\main\java\io\flutter\plugins\firebase\auth\FlutterFirebaseAuthPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Proof of Actions Performed
cmd: flutter --version
Flutter 3.3.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ffccd96b62 (5 days ago) • 2022-08-29 17:28:57 -0700
Engine • revision 5e9e0e0aa8
Tools • Dart 2.18.0 • DevTools 2.15.0
cmd: flutter pub outdated
Showing outdated packages.
[*] indicates versions that are not the latest available.
Package Name Current Upgradable Resolvable Latest
direct dependencies: all up-to-date.
dev_dependencies:
test *1.21.4 *1.21.4 *1.21.4 1.21.5
transitive dependencies:
font_awesome_flutter *9.2.0 *9.2.0 *9.2.0 10.1.0
material_color_utilities *0.1.5 *0.1.5 *0.1.5 0.2.0
source_span *1.9.0 *1.9.0 *1.9.0 1.9.1
test_api *0.4.12 *0.4.12 *0.4.12 0.4.13
vector_math *2.1.2 *2.1.2 *2.1.2 2.1.3
transitive dev_dependencies:
frontend_server_client *2.1.3 *2.1.3 *2.1.3 3.0.0
test_core *0.4.16 *0.4.16 *0.4.16 0.4.17
You are already using the newest resolvable versions listed in the 'Resolvable' column.
Newer versions, listed in 'Latest', may not be mutually compatible.
cmd: flutter pub upgrade
(modified to show the relevant ones)
Resolving dependencies...
//other packages
firebase_analytics 9.3.3
firebase_analytics_platform_interface 3.3.3
firebase_analytics_web 0.4.2+3
firebase_auth 3.7.0
//other packages
No dependencies changed.
8 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
file: app>android>build.gradle
//some codes
android {
compileSdkVersion 32
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.XXXX.app"
minSdkVersion 23 //recently changed from 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {
release {
//some codes
}
}
}
//some codes
If required I can furnish you with more details,
Thank you...

Related

How to resolve AGP build error Product Flavor 'development' contains custom BuildConfig fields, but the feature is disabled

I just upgraded my android studio to ...
Android Studio Flamingo | 2022.2.1 Canary 9
Build #AI-222.4345.14.2221.9321504, built on November 22, 2022
Runtime version: 17.0.4.1+0-17.0.4.1b469.62-9127311 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Metal Rendering is ON
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
ide.images.show.chessboard=true
gradle.version.catalogs.dynamic.support=trueNon-Bundled Plugins:
com.android.aas (3.5.1)
com.jetbrains.kmm (0.5.1(222)-30)
then I upgraded AGP to...
plugins {
id 'com.android.application' version '8.0.0-alpha09' apply false
id 'com.android.library' version '8.0.0-alpha09' apply false
}
now my gradle sync task reports these warnings...
Product Flavor 'staging' contains custom BuildConfig fields, but the feature is disabled.
Affected Modules: network, resource, access
and now my build fails with this...
FAILURE:
Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':background:network'.
com.android.builder.errors.EvalIssueException: Product Flavor 'development' contains custom BuildConfig fields, but the feature is disabled.

Cannot use Kotlin 1.7.10

I have a Kotlin project in IntelliJ IDEA (not targeting Android) that currently compiles fine with Kotlin 1.6.10. When I change to 1.7.10, I get the following errors:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'jwotd'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0.
Required by:
project :
> The consumer was configured to find a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0:
- gradle70JavadocElements
- gradle70RuntimeElements
- gradle70SourcesElements
- javadocElements
- runtimeElements
- sourcesElements
All of them match the consumer attributes:
- Variant 'gradle70JavadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides javadocs but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'gradle70RuntimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides a library but the consumer didn't ask for it
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
- Variant 'gradle70SourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides sources but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'javadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides javadocs but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides release status but the consumer didn't ask for it
- Variant 'runtimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides a library but the consumer didn't ask for it
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but the consumer didn't ask for it
- Variant 'sourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides sources but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides release status but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'apiElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Variant 'gradle70ApiElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
My top-level build.gradle:
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
One of my project build.gradle (there are several projects, all similar):
apply plugin: 'org.jetbrains.kotlin.jvm'
sourceSets {
main {
java.srcDirs "src/java"
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
api project(':cjk')
implementation project(':kokuban')
implementation platform('org.jetbrains.kotlin:kotlin-bom')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.beust:klaxon:5.0.1'
implementation "com.oracle.database.xml:xmlparserv2:21.1.0.0"
}
Open your gradle/wrapper/gradle-wrapper.properties file and modify the gradle version to:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
I had to manually upgrade gradle.
./gradlew wrapper --gradle-version 7.5.1
./gradlew --version
./gradlew build
After this, gradlew builds Kotlin 1.7.10 code, and it also builds successfully in IntelliJ IDEA. Interestingly though, the IntelliJ complains about unavailable features (definitely typed T & Any), but it can compile it and it seems to work.
Feels like IntelliJ IDEA CE does not officially support Kotlin 1.7.10 yet?
In my case, Just replace to
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'
From
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10'
https://kotlinlang.org/docs/gradle.html
When configuring your project, check the Kotlin Gradle plugin compatibility with available Gradle versions:
Kotlin 1.7.20 requires Gradle 6.7.1 as a minimum version. Kotlin 1.7.10 will do similarly.
Please check your Gradle version.
Invalidate Caches and Restart resolved my issue
This is how a freshly generated (by IDEA CE / gradle-7.4.2) build.gradle looks like
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
}
group = 'org.example'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.jetbrains.kotlin:kotlin-test'
}
test {
useJUnitPlatform()
}
compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}
compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
}
You can try adding this in your build and gradle.
kotlinOptions {
jvmTarget = "1.8"
}

Gradle build doing nothing on WSL

I'm writing a Kotlin program, and using Gradle as the build system, as is customary in that language. I usually work on Windows, but it's time to start testing on Linux, so using WSL for that. Installed Gradle, cloned a copy of my code in WSL...
(base) a#DESKTOP-4B7M920:~/ayane$ gradle -version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/usr/share/java/groovy-all.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
------------------------------------------------------------
Gradle 4.4.1
------------------------------------------------------------
Build time: 2012-12-21 00:00:00 UTC
Revision: none
Groovy: 2.4.16
Ant: Apache Ant(TM) version 1.10.5 compiled on March 28 2019
JVM: 11.0.7 (Ubuntu 11.0.7+10-post-Ubuntu-2ubuntu218.04)
So far so good, that warning happens sometimes, doesn't seem to portend immediate trouble.
This is my build file, that works on Windows:
(base) a#DESKTOP-4B7M920:~/ayane$ cat build.gradle.kts
plugins {
kotlin("jvm") version "1.3.72"
}
repositories {
jcenter()
}
dependencies {
implementation(kotlin("stdlib"))
testImplementation("org.junit.jupiter:junit-jupiter:5.6.2")
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
Here goes.
(base) a#DESKTOP-4B7M920:~/ayane$ gradle build
> Task :buildEnvironment
------------------------------------------------------------
Root project
------------------------------------------------------------
classpath
No dependencies
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
<-------------> 0% WAITING
Uh? I could understand if it threw an error because some prerequisite or other was unavailable. But no error, just nothing? What's going on?
You are using the newest version at this time of the Kotlin plugin for Gradle (1.3.72). However, you are using a really old version of Gradle (4.4.1). As you can read from the Kotlin documentation:
The Kotlin Gradle plugin 1.3.72 works with Gradle 4.9 and later.
It is unfortunate that the plugin doesn't check for this and give a more proper error message instead of just silently doing nothing. I guess you could create an issue for Jetbrains on this if you like.
Just as has been mentioned in the comment to your question, I also highly recommend using the wrapper. It ensures that the project is built with a particular declared version of Gradle that you, the build author, has decided on. Otherwise, you will have to document how to set up the environment correctly, including what version of Gradle to install.
Same thing goes for Java: be sure to clearly document which version is required or supported.
As for building in WSL, the only issue I've ever had with it was a remote build cache not working. This was because I had configured Git to checkout with POSIX line endings (LF) for source files, whereas the cache were populated on a Windows machine using CRLF line endings). It doesn't sound like you are using that feature, but other than that, everything has been working fine for me in WSL.

Quarkus gradle test fails

I am trying to run the simple 'getting-started'-type gradle project with quarkus and my unit test fails everytime with this error
Caused by: io.quarkus.bootstrap.BootstrapException: Failed to locate project pom.xml for C:\Users\myuser\IdeaProjects\myproj\build\classes\java\main
Followed instructions here https://quarkus.io/guides/gradle-tooling
Any suggestions or thoughts on what is going on?
Gradle version details
Gradle 5.4
Build time: 2019-04-16 02:44:16 UTC
Revision: a4f3f91a30d4e36d82cc7592c4a0726df52aba0d
Kotlin: 1.3.21
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 11.0.2 (Oracle Corporation 11.0.2+9)
OS: Windows 10 10.0 amd64
btw. the problem is still open (current version 0.19.1) and issue (2307) is still unresolved.
The reason is that #QuarkusTest points to the QuarkusTestExtension, which in BootstrapClassLoaderFactory.newDeploymentClassLoader attempts to resolve local project with Maven.
We have options:
wait for official solution (see issue)
write own extension overriding BootstrapClassLoaderFactory to "understand" gradle project structure
apply a workaround (for time being), i.e. generate pom.xml from gradle build
Workaround
in build.grade:
plugins {
id 'java'
id 'io.quarkus' version '0.19.1'
// ...
id 'maven-publish'
}
// ...
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
// augment your pom here if necessary
}
}
}
// ...
task createPom(type: Copy) {
description 'This is workaround to generate pom.xml, needed for #QuarkusTest tests.'
dependsOn('generatePomFileForMavenJavaPublication')
from "$buildDir/publications/mavenJava/pom-default.xml"
into '.'
rename('pom-default.xml', 'pom.xml')
}
Note:
use 'maven-publish', not obsolete 'maven' plugin.
do not forget to apply ./gradlew createPom on dependencies changes

New Gradle project (command-line and single-module) can't find Android plugin

I had a single-module project working in command-line Ant and want to convert it to Gradle but it fails at: 'gradle tasks', because it can't find the Android plugin.
This failure coincided with an upgrade to the Android SDK/Tools & Support Repository.
I'm using windows 10 and the TextPad editor (DOS command line screen is included).
The Gradle version is 2.12
build.gradle:
apply plugin: 'com.android.library'
android{
compileSdkVersion 20
buildToolsVersion '23'
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
repositories{
jcenter()
}
dependencies{
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
Note:
I've tried moving the repositories and dependencies out from under the android {}'s.
Error Message:
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Android\Clox\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating root project 'Clox'.
Plugin with id 'com.android.library' not found.
local.properties file:
sdk.dir=c:\users\chatt\AppData\Local\Android\sdk1
or
sdk.dir=C\:\\Users\\chatt\\AppData\\Local\\Android\\sdk1
I included this because it seems to ignore my JDK_HOME.
JDK_HOME started off pointing at JAVA_HOME. I tried changing JDK_HOME to: 'XXX' and it just gave the usual error.
JDK_HOME is now c:\users\chatt\AppData\Local\Android\sdk1, which I got from the header of the Android SDK Manager, and ANDROID_HOME=%JDK_HOME%.
RECENT TESTING:
I had a sequence of errors that I found the answers to in:
https://stackoverflow.com/questions/
(thank you people)
and then I updated the JDK, adding the Build Tools, with the results:
Packages
- Android SDK Tools, revision 25.1.1
- Android SDK Build-tools, revision 23.0.3
...
- Android Support Repository, revision 30
plus I see there is installed:
-Android SDK Platform 6.0 (API 23)
-Android Support Library v.23.2.1
Apparently this update is what caused the com.android.library plugin not found error; apart from a JAVA_HOME error that's all it gives me.
Apparently my build.gradle structure was wasn't sufficiently standard.
I've switched to a version from:
http://tools.android.com/tech-docs/new-build-system/user-guide
buildscript {
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
}