Flutter project couldn't resolve ':classpath' - flutter

I'm trying to run an app but I encounter this;
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all files for configuration ':classpath'.
Could not find com.google.gms:google-services:4.3.13.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.13/google-services-4.3.13.pom
- https://repo.maven.apache.org/maven2/com/google/gms/google-services/4.3.13/google-services-4.3.13.pom
Required by:
project :
I have put google-services.json in app folders,
I have tried:
gradlew --scan : I got and exception.
Gradle version: 7.4
Plugin version: 3.8.1
Request URL: https://scans-in.gradle.com/scans/publish/gradle/3.8.1/token
Request ID: 518f437c-3ef8-481c-8c00-a1d76826c7a8
Exception: java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 403 Request blocked by Privoxy"
I tried using VPN and still did not work

try reinstalling android build tools
and
add this line "systemProp.http.nonProxyHosts=*|localhost"in gradle.properties

Related

I tried running my flutter app on an Emulator and it showed the following error

A problem occurred configuring root project 'android'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:4.1.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:4.1.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'.
> Remote host terminated the handshake
To solve this I open the app in android studio for editing and the artifacts are automatically downloaded.
There might be other workarounds but this works for me.
How to open flutter app for editing?
https://stackoverflow.com/questions/60462318/cant-find-open-for-editing-in-android-studio#:~:text=Got%20to%20your,the%20IDE.%20Source.

hello im try to run my flutter app on my real android phone but give me a lot of errors

Launching lib\main.dart on STK L21 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:4.1.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:4.1.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'. Received status code 403 from server: Forbidden
Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
Required by:
project :
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'. Received status code 403 from server: Forbidden
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 5s
Exception: Gradle task assembleDebug failed with exit code 1
How to Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” Error?
To Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” this problem is caused by updating the Gradle. The Android Studio always asks you to update it, but don't do this for flutter apps. I solved it with the following versions On build.gradle module level.
Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” Error
To Solve Flutter problems: “Could not resolve all artifacts for configuration ':classpath' ” this problem is caused by updating the Gradle. The Android Studio always asks you to update it, but don't do this for flutter apps. I solved it with the following versions On build.gradle module level
please follow this link :https://fluttercorner.com/flutter-problems-could-not-resolve-all-artifacts-for-configuration-classpath/
First You run Flutter Doctor

Getting "Error running Gradle" in step "resolving dependancies" when I try to execute a flutter project

I suspect the proxy setting is not set correctly, or I might be wrong, please help me out here. I'm working under a corporate network and using a VPN.
Error details below:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "D:\flutter_workspace\flutter_app\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
Finished with error: Please review your Gradle project setup in the android/ folder.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.2.1.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.2.1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
> Connect to dl.google.com:443 [dl.google.com/172.217.9.14] failed: Connection refused: connect
* 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 17s
Command: D:\flutter_workspace\flutter_app\android\gradlew.bat app:properties
Finally finally figured out what I was missing, I had to set the Proxy in gradle.properties file as directed in developers.android.com. For some reason, setting up the proxy in Android Studio alone didn't work.
Updated gradle.properties file:
org.gradle.jvmargs=-Xmx1536M
systemProp.https.proxyHost=proxy.company.com
systemProp.https.proxyPort=80
PS: Thanks #Taio for your efforts. I appreciate them
Check your internet connection and make sure it is stable. Gradle is trying to connect to the internet to get resources and is unable to.
In this case I would suggest turning off the vpn and waiting for the build process to go on with a normal internet connection then after build you can continue using the vpn

IONIC 4 gradle failed

I'm using IONIC 5.2.4.
when run command ionic cordova build android throw this exception
A problem occurred configuring root project 'android'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find com.android.tools.build:gradle:3.3.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.0/gradle-3.3.0.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.0/gradle-3.3.0.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.0/gradle-3.3.0.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.0/gradle-3.3.0.jar
Required by:
any one help me :-(

Ionic 3 project and plugin crosswalk error

I have a Ionic 3 project, when I run "ionic cordova run android --prod" I see
This error:
ANDROID_HOME=C:\Users\asus\AppData\Local\Android\sdk\
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131\
Subproject Path: CordovaLib null
The Task.leftShift(Closure) method has been deprecated and
is scheduled to be removed in Gradle 5.0. Please use
Task.doLast(Action) instead.
at build_86b8k75dm7qqz7n5jyg9xp8kh.run(D:\project\ionic\MyProject\platforms\android\build.gradle:138) org.xwalk:xwalk_core_library:23+ The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature. The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInp uts.file(Object).skipWhenEmpty() instead.
FAILURE: Build failed with an exception.
* What went wrong:
BUILD FAILED
Total time: 15.644 secs A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugApkCopy'.
> Could not resolve org.xwalk:xwalk_core_library:23+.
Required by:
project :
> Could not resolve org.xwalk:xwalk_core_library:23+.
> Failed to list versions for org.xwalk:xwalk_core_library.
> Unable to load Maven meta-data from https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org /xwalk/xwalk_core_library/maven-metadata.xml.
> Could not GET 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_ library/maven-metadata.xml'. Received status code 503 from server: Service Unavailable
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Error: cmd: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.
* What went wrong: A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugApkCopy'.
> Could not resolve org.xwalk:xwalk_core_library:23+.
Required by:
project :
> Could not resolve org.xwalk:xwalk_core_library:23+.
> Failed to list versions for org.xwalk:xwalk_core_library.
> Unable to load Maven meta-data from https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org /xwalk/xwalk_core_library/maven-metadata.xml.
> Could not GET 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_ library/maven-metadata.xml'. Received status code 503 from server: Service Unavailable
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova run android (exit code 1).
I did not recieve this error before running Ionic.
The 01.org server seems to be down. So till the servers are back online, you can ask Gradle to use the local copy of Crosswalk.
I was having the same issue from last one hour. The following solution worked for me.
Open platforms\android\cordova-plugin-crosswalk-webview\*-xwalk.gradle file in your project directory, where * is your project name.
Look for the section -
dependencies {
compile xwalkSpec
}
Replace it with your exact Crosswalk version which you find in Chrome Developer Tools by typing window.navigator.userAgent in your Developer Tools console.
So your final data would look something like this -
dependencies {
compile 'org.xwalk:xwalk_core_library:23.53.589.4'
}
1 Get crosswalk version
There are another two ways to get xwalk_core_library version, you can use either of them:
Go to platforms/android/build/intermediates/exploded-aar/org.xwalk‌​/xwalk_core_library/‌​, then you can see version like 19.49.514.5
In the Google cache, you can select a version number
2 Change the gradle
Just like #hemantv said, in file platforms\android\cordova-plugin-crosswalk-webview*-xwalk.gradle
Change the file form
dependencies {
compile xwalkSpec
}
to
dependencies {
compile 'org.xwalk:xwalk_core_library:19.49.514.5'
}
19.49.514.5 is the version get from the step one.
Another way, you can use this plugin temporarily:
cordova plugin add https://github.com/zhouzhongyuan/cordova-plugin-crosswalk-webview
It just fixed this error.
Get Crosswalk version
As answered by Zhongyuan Zhou, there are ways to get locally saved Crosswalk library on your project, but I prefer the following:
Go to platforms/android/build/intermediates/exploded-aar/org.xwalk‌​/xwalk_core_library/‌​, then you can see version like 22.52.561.4
Modify config.xml
Add the following into your config.xml
<preference name="xwalkVersion" value="xwalk_core_library:22.52.561.4" />
Compile the Android build
Do the usual ionic cordova build android to build the Android APK or ionic cordova run android to build and run / install the Android app on an emulator or device.
Reference: https://forum.ionicframework.com/t/server-error-with-crosswalk-when-running-ionic-run-android/104009/15
This is follow up to hemantv's answer. I was panicking but his answer saved my day, and I was able to successfully compile the app using the locally stored xwalk.
This is what I did and i hope it helps someone out there who's stuck with the same predicament.
I found out the Crosswalk version I have stored locally by running a search (including sub directorys) for "xwalk_core_library" in my app directory and found the file "org.xwalk-xwalk_core_library-17.46.448.10_9bf812c8b76a44fdb31553d48df45b60d1362adc.jar" and figured out the version I had was "org.xwalk-xwalk_core_library-17.46.448.10" (everything after the underscore "_" is irrelevant)
I followed the instructions and opened up the platforms\android\cordova-plugin-crosswalk-webview*-xwalk.gradle in a text editor
found
dependencies {
compile xwalkSpec
}
replaced with
dependencies {
compile 'org.xwalk:xwalk_core_library:17.46.448.10'
}
reattempted to compile and it worked like a charm.