How can i install this libraries? - flutter

[enter image description here][1]I have a problem with two libraries, one shows as this "C:\src\flutter.pub-cache\hosted\pub.dartlang.org\path_provider_macos-2.0.0\lib" and the other one is "C:\src\flutter.pub-cache\hosted\pub.dartlang.org\shared_preferences_macos-2.0.0\lib", they appear in red line like this picture, i've uninstalled and installed back Android Studio, i also copy the config from a "new flutter project" to my actual project, i also managed to upgrade the other libraries by using other tutorials, but i cant install this two libraries yet, on top of that, each time i press the play button on android studio to start installing my app to my phone, this error appears:
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not find com.github.agorabuilder:native-full-sdk:3.4.2.
Required by:
project :app > project :agora_rtc_engine
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 23s
Exception: Gradle task assembleDebug failed with exit code 1```
[1]: https://i.stack.imgur.com/wNXhP.png

Try this :
clean project
rebuild project
file/ Invalidate caches / restart

In the project-level build.gradle file of your android project add the following repository "maven { url 'https://jitpack.io' }" It should look similar to this
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
centre()
maven { url 'https://jitpack.io' }
}
}
allprojects {
repositories {
google()
centre()
maven { url 'https://jitpack.io' }
}
}

Related

Build failed - Could not resolve io.grpc:grpc-core:[1.28.0]. (yes I have upgraded to mavenCentral())

I was able to build and publish my flutter app on October 6th, I returned today on Octuber 30th and I am getting this build error:
Could not resolve io.grpc:grpc-core:[1.28.0].
Could not HEAD 'https://jcenter.bintray.com/io/grpc/grpc-core/maven-metadata.xml'.
Read timed out
It seems there is an issue with cloud_firestore somehow it's still trying to read from jcenter which I am informed that it's down and not supporting new repositories, but the issue is that I have not changed a single line nor updated any packages since my last publish and build, what caused this issue?
I remember I had a similar issue a few months ago but everything was fixed after I replaced jcenter with mavenCentral, but this time it's back again.
Launching lib\main.dart on Android SDK built for x86 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve io.grpc:grpc-core:[1.28.0].
Required by:
project :app > project :cloud_firestore > com.google.firebase:firebase-firestore:21.7.1 > io.grpc:grpc-android:1.28.0
project :app > project :cloud_firestore > com.google.firebase:firebase-firestore:21.7.1 > io.grpc:grpc-okhttp:1.28.0
> Failed to list versions for io.grpc:grpc-core.
> Unable to load Maven meta-data from https://jcenter.bintray.com/io/grpc/grpc-core/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/io/grpc/grpc-core/maven-metadata.xml'.
> Read timed out
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 37s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
This is my build.gradle:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Yes, my app is pretty old, since I have yet to update to null-safety.
Any tips to avoid this issue in the future?
How do I solve this current issue?
Same to me
Could not HEAD 'https://jcenter.bintray.com/com/stripe/stripe-android/maven-metadata.xml'.
> Read timed out
It seems that there is an issue with JCenter. It should be available, although it was changed to read only.
See also https://updownradar.com/status/jcenter.bintray.com
And I don't expect solutions on Sunday ;) So just wait till tomorrow.
Regarding JFROG:
UPDATE 4/27/2021: We listened to the community and will keep JCenter as a read-only repository indefinitely. Our customers and the community can continue to rely on JCenter as a reliable mirror for Java packages.
(Source https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/)
It seems Jcenter was just down, as per https://developer.android.com/studio/build/jcenter-migration the website will continue to provide read-only repositories indefinitely.

My flutter project broke and I get this gradle error

FAILURE: Build failed with an exception.
* What went wrong:
Could not create an instance of type org.gradle.invocation.DefaultGradle.
> Could not configure services using GradleScopeCompileServices.configure().
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1
This is my build.gradle
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I tried so many things I changed flutter and gradle version and looked everywhere but I still get this error. It worked before now it just doesen't. Btw java version is set to 1.8
Faced the same issue.
Solution:
Downgrade flutter version from 2.2.3 to 2.2.2
Delete ~/.android folder.
Restart android studio.
That kind of error has like a hundreds reason no one can know except to remember what you had done before. But anyway for better solution follow the following:
go to tools tab then flutter clean
go to file tab then invalidate cache and restart
follow the steps in this article to have the latest updates from Gradle
finally go to android folder then build gradle then on top right you will see edit file or something similar .. press on it and open new window and let it auto update till the end .. and better if you go to file into that new window then select project structure and manually see what the warning will it show to you and only press update
And don't forget to use the latest Flutter SDK.

get exit code 1 when run flutter project

when i run flutter project i get this error .
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.
> Problems reading data from Binary store in
C:\Users\Mohammad\AppData\Local\Temp\gradle3241964870133562548.bin offset 235082 exists? true
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 8s
Exception: Gradle task assembleDebug failed with exit code 1
i restart my pc and after clean temp directory , also i run flutter clean but this error yet exist please help me my build.gradle file is
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
maven { url "https://maven.google.com/"}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}

when i run my flutter app ,there emerge a unexpected problem , error :

What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not resolve project :path_provider_macos.
Required by:
project :app > project :path_provider
Unable to find a matching configuration of project :path_provider_macos: None of the consumable configurations have attributes.
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.
Get more help at https://help.gradle.org
BUILD FAILED in 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
Some imports are missing. Try flutter pub get to update packages, or flutter pub cache repair, which will re-import all dependencies.
thank everyone , i get the solution about my problem : go to your Flutter sdk folder ,then go to .pub-cache\hosted\pub.dartlang.org\ ,if there have a path_provider_macos-0.0.4 folder ,delete it ,if no ,you try go .pub-cache\hosted\pub.flutter-io.cn\ , and remove path_provider_macos-0.0.4 folder
Deleted the folder you said,but show this wrong : Project :flutter declares a dependency from configuration 'embed' to configuration 'default' which is not declared in the descriptor for project :path_provider_macos.
The following is detailed:
> A problem occurred configuring project ':flutter'.
> Could not resolve all dependencies for configuration ':flutter:embed'.
> Could not resolve project :path_provider_macos.
Required by:
project :flutter
> Project :flutter declares a dependency from configuration 'embed' to configuration 'default' which is not declared in the descriptor for project :path_provider_macos.
> Could not resolve project :path_provider_linux.
Required by:
project :flutter
> Project :flutter declares a dependency from configuration 'embed' to configuration 'default' which is not declared in the descriptor for project :path_provider_linux.

Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.1) classpath

I recently added one new library to my flutter app. It started showing me an error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.1) classpath. You should manually set the same version via DependencyResolution
* 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.
* Get more help at https://help.gradle.org
BUİLD FAILED in 14s
try to go to the dependencies and change the compile to 1.0.1
Step 1. Go to gradle.properties under android folder, and add the following piece of code:
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
Step 2. Now go to build.gradle under android and not under the app->build.gradle. While looking into the file make sure it starts with the word builscript (In this way you can ensure you're at the right build.gradle file.)
Step 3. Ctrl+A everything in that file, note that ctrl+A everything you need to erase off all the content and paste this piece of code:
buildscript {
ext.kotlin_version = '1.3.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "27.1.1"
}
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('androidx') ) {
details.useVersion "1.0.1"
}
}
}
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
A very important point to note is that during the process of compilation, chances are that you will see this warning message in complete red. Please don't get scared of it and let the whole compilation complete, before jumping to any conclusions. Although it comes in red, it won't stop your compilation as you will see in the bottom a turning circle that will show the progress of compilation. Right after that, it will disappear and you will be able to run the App. Here's the warning message:
Note:
C:\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.11\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java
uses or overrides a deprecated API. Note: Recompile with
-Xlint:deprecation for details. Note: C:\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.11\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java
uses unchecked or unsafe operations. Note: Recompile with
-Xlint:unchecked for details. ERROR: [TAG] Failed to resolve variable '${animal.sniffer.version}' Note:
C:\flutter.pub-cache\hosted\pub.dartlang.org\mlkit-0.15.0\android\src\main\java\com\azihsoyn\flutter\mlkit\MlkitPlugin.java uses unchecked or unsafe operations. Note: Recompile with
-Xlint:unchecked for details.
And Boom! that's it. Trust me this will definitely solve your problems.
In case you still struggle with any such problems try to implement some of the other solutions mentioned in this link as well.