I've been banging my head on the wall for about a week trying to solve this issue.
I've recently started work on an app using the Ionic Framework, and I keep getting the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:1.0.0+.
Required by:
:android:unspecified
> Failed to list versions for com.android.tools.build:gradle.
> Unable to load Maven meta-data from http://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml.
> Failure initializing default system SSL context
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I've done some extensive Googling, wherein people have suggested removing some gradle config files from ~/.gradle, making sure my Android SDK is updated, and quite a lot about corporate proxies. Well, I deleted the configs and re-generated them, I've updated EVERYTHING in my SDK, and I am not using a proxy of any kind (at least I have not gone out of my way to set any up).
When I ping http://repo1.maven.org, I get:
ping: unknown host http://repo1.maven.org
However, I can type the address into the address bar on Chrome and it will show me the file(s).
It is very important for me to get this working, as it's for my Senior Capstone project at University. If anyone has any ideas, I am willing to try.
Thank you in advance!
Also make sure "Google Repository" from your Android SDK is installed. You will find this under Extras section.
I solved the issue by replacing my openjdk installation with Oracle's jdk, and updating my Android SDK with:
android update sdk --no-ui --filter extra
Apparently the GUI wasn't showing all extra options, even though I told it to reload several times.
Related
I want to run a flutter application that I wrote on Visual Studio Code on the device. However, when I do this, I always get the following error. Normally this wouldn't happen, it's just starting to happen. I'm not entirely sure what I should do.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Kotlin could not find the required JDK tools in the Java installation '/usr/lib/jvm/oracle-java8-jre-amd64' used by Gradle. Make sure Gradle is running on a JDK, not JRE.
* 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 45s
Exception: Gradle task assembleDebug failed with exit code 1
OS : Ubuntu
Mobile Device : Samsung J500F
Android Version : 6.0.1
You need to have installed a JDK. Depending on which version of Ubuntu you should just be able to do sudo apt install openjdk-8-jre-headless
That said, I would target a higher Java version, if I were you, maybe 11?
Either way, if you look at the path your JRE is in, it's '/usr/lib/jvm/oracle-java8-jre-amd64'
You don't want to be using the regular JRE to build/run your application. You want to build and run with openjdk. That's why your error message says,
"Make sure Gradle is running on a JDK, not JRE."
The message Execution failed for task ':app:compileDebugKotlin' and the Gradle issue indicate that your problem is not about Flutter but about Android, and more precisely about the lack of JDK (which allows to execute Java and Kotlin code).
To solve this problem, it is necessary to review the configuration of your project.
I advise you if possible to use Android Studio, an IDE recommended by Android developers and that will make things much easier with Android and Flutter.
This article from the official Android documentation and this one from JetBrains should help you solve your problem.
You can install Android Studio from snap store or zip
I'm trying to set up Flutter on a PC without internet connection.
I get stuck on "Resolving Dependencies" when trying to run an app (on a physical Nexus 5), and after some time I get a "Build failed with an exception" and a lot of failed download messages.
I installed the required software (inc. VSCode) as well as copied the flutter and gradle folders from my other PC where I normally use Flutter to develop.
Flutter doctor says I'm all good. I created the app offline using "flutter create --offline name_of_app".
This happens even if I try to run the app using Android Studio with gradle set to offline work and a path is directing to a full gradle distribution.
The error is:
* Error running Gradle:
ProcessException: Process "C:\name_of_app\android\gradlew.bat" exited abnormally:
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 download gradle.jar (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.jar'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar'.
And it continues to mention other file names as well.
What am I missing? I can run the app on my other PC when I disconnect it from the internet.
Thanks in advance.
As a beginner both in programming and in flutter I commit this answer with caveats. It worked on my machine (a Lenovo laptop), on Manjaro Linux.
First problem I had encountered during the compilation phase was the -beta01 problem. The gradle offline plugin available for download from android studio site has currently version number 3.5.0-beta01. By some automatism 'flutter create --offline' sets the dependency to gradle:3.5.0 in the global build.gradle file. I solved that part of the problem by replacing 3.5.0 with 3.5.0-beta01.
Second problem was a number of missing dependencies compiler complained about. I downloaded them all and put them in the gradle plugin folder (in Linux it's /home/username/.android/manual-offline-m2/android-gradle-plugin-3.5.0-beta01/ - the recommended path from the Android studio configuration walk-through). They were mostly gradle and kotlin related.
When I resolved the second order dependencies the work was done. The base flutter app compiled with no errors , with all the offline settings (online repositories' paths in global build.gradle commented out, internet disconnected).
For offline use, which is solely for learning purposes, I plan not to update flutter channels, nor the maven and gradle plugin, being that the only reason one would use a computer with no internet access for flutter is for learning in the beginner's phase ... Up in the mountains of Croatia... At least that's where I plan to use it :D
I have just started with ReactNative and created a project using this tutorial. The project got built and a android application got installed on my phone.
Then I used #shoutem/ui library for UI components. According to the documentation, I tried
npm install #shoutem/ui --save
react-native link
and then run the project using
react-native run-android
But then I got this error
PS D:\SK\Study\ReactNative\DemoRN> react-native run-android
Scanning folders for symlinks in D:\SK\Study\ReactNative\DemoRN\node_modules (38ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
File C:\Users\sukumar\.android\repositories.cfg could not be loaded.
Failed to download any source lists!
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-photo-view'.
> Failed to find Build Tools revision 25.0.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 11.028 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
And then I unlinked the #shoutem/ui
react-native unlink #shoutem/ui
and tried to run the project, but still, I am facing the same issue?
Please ignore if it is too basic to ask, But I am not able to understand what is the issue?
Update
I am not using Android Studio, So I downloaded the build-tools 25.0.0 and placed in sdk/build-tools folder. But now I am facing
> A problem occurred configuring project ':react-native-photo-view'. > Failed to find Platform SDK with path: platforms;android-23
This seems to be an issue with the available SDK Tools in your installation of Android Studio:
> Failed to find Build Tools revision 25.0.0
Installing these should resolve the issue. To install this, start up Android studio, go to the SDK Manager and select the SDK Tools tab, check the Show Package Details option in the bottom right corner and then check the 25.0.0 SDK Tools and click Apply to download and install them.
Here's a screenshot of the SDK Tools I use for my local environment for reference:
Furthermore, I'd just like to elaborate on the react-native (un)link command. This is used to link native dependencies into your React Native project. Unlinking it is not the same as uninstalling it, you should still be able to use all non-native components of the Shoutem UI Toolkit after unlinking the package.
I am not using Android Studio, So I downloaded the build-tools 25.0.0 and placed in SDK/build-tools folder. This solved the build tools issue but then there was a new issue
A problem occurred configuring project ':react-native-photo-view'. > Failed to find Platform SDK with path: platforms;android-23
The network I was using has configured some firewalls rules that were not allowing the required dependencies get downloaded. When you run react-native run-android it downloads all the dependencies automatically to create the build.
So In my case, I changed my network settings and this worked.
I am attempting, in Windows 7, to compile my Ionic project Android platform using the Ionic CLI. This is something that previously worked, and now does not. The only thing that has changed is that I upgraded Android Studio. However, I am not compiling with Android studio, so I am surprised that I am getting Gradle errors. For:
$ ionic run android
The output is:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugApk'.
> A problem occurred configuring project ':CordovaLib'.
> Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
> Could not find com.android.tools.build:gradle:2.2.3.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
Required by:
android:CordovaLib:unspecified
Though the output claims that I can gain additional error info with the --stacktrace and --debug flags, this is untrue.
I have seen threads suggesting that the problem is that one or more of mavenCentral() or jcenter() are missing from the repositories list in the build.gradle. These are both present.
I tried just throwing an HTTP GET at the addresses and it comes back 404. Is there somewhere else that I can direct Gradle to look for these files?
Possibly the strangest thing is that the files that it claims it can't find, actually do get downloaded into the Gradle cache each time (if I clear them, they appear the next time I execute the command). They appear in:
~/.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle/2.2.3/88b4934c958cfe74ff5559c1a33707a562af59d2/gradle-2.2.3.pom
and
~/.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle/2.2.3/7b8f79621d95e3ce1e95c0852db14d9d7e1d1951/gradle-2.2.3.jar
Steps I've taken so far:
upgrade Gradle
clear both gradle and Maven repositories
Try it off the company intranet with the --no-proxy flag on
I'm not sure what the next troubleshooting step should be.
I had same issue on mac, what worked for me was fresh install of android studio and ionic.
So probably first uninstall everything, then install android studio update it install whatever tools required, install gradle THEN install cordova and ionic.
This is maybe due to the path.Ionic is not able to find the path of the sdks in the same folder as u are giving there in your environment variables .
Try to change environment variables. Maybe you have given a local path instead of global hence it was not able to find sdks of your android studio.
I can run my ionic project on android device perfectly until now but now this error is happens. I did not change anything in project structure.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
> Could not find any version that matches org.xwalk:xwalk_core_library_beta:13+.
Searched in the following locations:
https://repo1.maven.org/maven2/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
https://repo1.maven.org/maven2/org/xwalk/xwalk_core_library_beta/
https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
file:/Applications/android-sdk/extras/android/m2repository/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
file:/Applications/android-sdk/extras/android/m2repository/org/xwalk/xwalk_core_library_beta/
file:/Applications/android-sdk/extras/google/m2repository/org/xwalk/xwalk_core_library_beta/maven-metadata.xml
file:/Applications/android-sdk/extras/google/m2repository/org/xwalk/xwalk_core_library_beta/
Required by:
:android:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 20.525 secs
/Users/myuser/Projects/appname/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/myuser/Projects/appname/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/myuser/Projects/appname/platforms/android/build.gradle,-PcdvBuildArch=x86,-Dorg.gradle.daemon=true
I removed android platform and all node_modules and added them again but still i see this error.
i can serve my app and run on IOS simulator perfectly.
I had the same problem!
I solved it with the following steps:
Remove browser with ionic browser revert android
Install crosswalk again ionic browser add crosswalk
Deploy aplication ionic run android
I had same problem, on run time I used VPN in ionic build android and Ionic run android command. this will help to reach the website to download components.
Also about the maven
I run CMD command with "Run as Administrator" it started to download maven and after that it works fine for me.
Before this I used to upgrade JDK and JRE but has not change in result.
I have upgraded Windows 7 to Windows 10 directly and some times applications needs to start by using "Run As administrator"
I have found the solution for the problem using the google play service and Google Repository in android SDK
Please install the following dependency using android SDK manager Google Play services and Google Repository
Once the installation is completed then you create your project and run.
Now it should work fine