I have been dealing with a problem in android studio gradle for hours, and i could not solve it.
I am just trying to build my very first projects but there is a problem with gradle.
This is how my build.gradle file looks like:
plugins {
id 'com.android.application' version '7.4.0' apply false
id 'com.android.library' version '7.4.0' apply false
}
enter image description here
This is the context of problem:
A problem occurred configuring root project 'My Application'.
> Could not resolve all files for configuration ':classpath'.
> Could not find gradle-7.4.0.jar (com.android.tools.build:gradle:7.4.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.4.0/gradle-7.4.0.jar
> Could not find builder-7.4.0.jar (com.android.tools.build:builder:7.4.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/7.4.0/builder-7.4.0.jar
> Could not find bundletool-1.11.4.jar (com.android.tools.build:bundletool:1.11.4).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/1.11.4/bundletool-1.11.4.jar
> Could not find protos-30.4.0.jar (com.android.tools.analytics-library:protos:30.4.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/30.4.0/protos-30.4.0.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I also added the image.
I don't know how to fix this, and any help would be appreciated.
I've observed the same issue. I've found some ambiguities that might explain what's going on.
If you naviagate to https://maven.google.com/web/index.html#com.android.tools.build:gradle:7.4.0 you'll get a web page that will give you information about com.android.tools.build.gradle-7.4.0. If you hover over the link for the jar or pom file you'll get a different url from the ones that your search indicated: https://dl.google.com/android/maven2/com/android/tools/build/gradle/7.4.0/gradle-7.4.0.jar. Notice that the "/dl/" part is missing. That's at least what my browser was showing me at the bottom of the browser window. Seeing that, I went into my setting.gradle.kts file and edited my pluginManagment repositories section by added the following repository:
maven {
url = uri("https://dl.google.com/android/maven2/")
}
I was then able to build my project without getting an error about not finding the com.android.tools.build.gradle plugin. In my case, I saw a slightly different list of locations of what it was searching for. Mine was failing because it couldn't fine the gradle-7.4.0.pom file, and not the jar file. So, I'm not exactly seeing exactly what you're seeing, but there's a good chance it related since the pom file is normally read before the jar file when resolving plugin artifacts from a repository.
When I was getting the problem, I would copy the link of the repositories searched and paste it into a browser and sure enough I would get an http 404 error using those searched url location. And when I modified the link by removing the "/dl/" part of the link, the file would download. So, you might think that my explanation explains the issue. However, after I got the issue resolved, I reentered the URL that was failing in my browser (the url with the "/dl/" part), but this time it worked correctly without any errors. The only explanation that I can come up with on why the url sometimes works and sometimes fails is that the server or proxy server processing that url request is sometimes offline.
With all of that said, you may run into the next issue. In order to use android gradle 7.4 you must be using an version of android studio greater than Android Studio Dolphin | 2021.3.1 Patch 1. see https://developer.android.com/studio/releases#android_gradle_plugin_and_android_studio_compatibility Unfortunately, it is my understanding that all of the versions of Android Studio, that would be compatible with using android gradle plugin 7.4 are only available as preview Android Studio releases. So if you're developing and restricting yourself to only building code using officially released stable tools, you're stuck using android gradle plugin 7.3.1, until the next version of android studio gets official released.
Related
Can anybody recommend a working Android Studio sample app that I can use for Oculus Quest 2, preferably with good documentation? I am looking for something I can build and run to start playing with their OpenXR Mobile SDK.
I am on an Intel Macbook Pro running macOS Big Sur, and I tried with the latest stable Android Studio release (Arctic Fox).
I have tried two different samples so far:
VrSamples/VrCubeworld_Framework - from the official Oculus docs:
Android Development Software Setup
Getting Started with Oculus Native Samples: Import Gradle Project
After following all the steps, I keep hitting this error:
NDK not configured. Download it with SDK manager. Preferred NDK version is '21.0.6113669'.
I'm convinced my NDK is installed:
I believe I've tried every workaround listed in the popular Stackoverflow question, and the linked Google issue.
hello_xr - a comment on the Oculus Forum links to this helpful blog post with more detailed instructions than the official Oculus docs. Unfortunately, after following those, I hit this build error:
C/C++: /Users/dj/Code/OpenXR-SDK-Source/src/CMakeLists.txt debug|armeabi-v7a : CMake Error at /Users/dj/Code/OpenXR-SDK-Source/src/version.cmake:25 (file):
file STRINGS file
"/Users/dj/Code/OpenXR-SDK-Source/src/include/openxr/openxr.h" cannot be read.
Call Stack (most recent call first):
CMakeLists.txt:318 (include)
There doesn't appear to be an include folder under src, and there is no openxr.h in the top level include/openxr folder.
UPDATE: At Jherico's suggestion, I downloaded Oculus OpenXR Mobile SDK v1.0.13 and OpenXR-SDK-Source release-1.0.13, and followed the instructions again to exactly match the versions used in the blog post, and ultimately I did get it working!
I created https://github.com/daj/OculusHelloXR to snapshot my working Android Studio project with all its dependencies, with individual commits for each step that I followed (I had to make a couple of changes to steps in the blog post to get it working).
I wrote everything up in this blog post: https://daj.medium.com/oculus-vr-for-android-developers-a38134c759b0
The blog post instructions are likely out of date, since they're from April and the most recent version of the OpenXR SDK has it's own new build.gradle file for hello_xr that was added in 1.0.20 in October.
If you want to go by the blog post, I'd suggest that after you check out the OpenXR-SDK-Source repository, you then run git checkout release-1.0.14 since that would be the version that the blog post was written against.
Alternatively, you can just ignore the blog post and try importing the build.gradle project directly into Android Studio (basically following the "Import Gradle Project" steps you linked to, but importing hello_xr from the current version of the OpenXR-SDK-Source project instead) and try seeing it that builds.
If you're still getting NDK errors you might try explicitly setting the ANDROID_NDK_ROOT environment variable, and make sure it's visible to your build process.
I checked every thread related to that error. But I couldn't find the appropriate answer. I have additional error too. Check out the screenshots.
Posts I came across recommending fixing JDK pathing issues through "Switch IDE book JDK..." or "Project Structure".
For me, in Android Studio 3.0, "Project Structure" would no longer open, so I upgraded to 3.1. Afterwards, it still had the JDK version error, but now it let me open "Project Structure" from the "File" menu, where I was able to correct the JDK, SDK, and NDK locations and versions.
There were still several build errors after that, but clicking the recommended fix in the build output window eventually installed everything I needed. Once it managed to synchronize correctly, it also upgraded Gradle to version 4.4. That then required new build tools and so forth.
Though instructions directly, may not help everyone, but it points to configuration corruption. So, if you cannot just upgrade to get around it, I recommend making backup copies of your Android Studio settings (generally in your user's home directory like ~/.AndroidStudioX.Y), as well as your project .idea (generally in the root of your project), then deleting the originals. If that is still not enough, purge the configurations again and reinstall Android Studio.
Note: I was going back into an old project so several warnings about deprecated features being removed in 2018 had to be dealt with.
error window
Here's what worked for me!
1. First verify that your JDK is indeed higher than JDK8
jdk version
2. Press "Ctrl+Alt+Shift+S" to open project structure
enter image description here
3. Then I selected "Use the embedded JDK"
4. Click OK and retry it.
That should solve it.
I was facing same problem, getting these two kinda errors:
SDK path should not contain white space.
Gradle sync failed. Please use JDK 8 or newer.
Solution for me was to set proper SDK path with no white space in path first and than choose JDK path. After setting path I've synced the project and tada it worked...
Thanks.
I recently updated to the latest version of XCode and Xamarin Xamarin.iOS 10.0.0.1 (29910bb) running Visual Studio Professional 2015 Version 14.0.25431.01 Update 3. Both my Mac (build machine) and PC are fully up to date. Now that i have update i am no longer able to compile/build for anything but the simulator.
Compiler Error.
> C:\Program Files
> (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(1028,3): error :
> Failed to read file attributes for
> "/Users/mod/Library/Caches/Xamarin/Resources/Images.xcassets"
As a test i copied the solutions file over to the build machine and with no modifications it compiles and runs any of the targets.
I have also tried deleting the builds directory on the build machine and no help.
Anyone know what the work around is for this?
I have come across is this issue and what seems to possibly be related to on Xamarin Forums. The thing I found in my case was related to image assets within a library I was trying to use. I was able to remove the image assets and relocate to main project and that seemed to resolve the build issue.
This problem, like you have found is very recent. For what's it worth, I have also found that command line tools have numerous issues as they seem to lag behind the GUI provided in either Xamarin Studio or Visual Studio.
Good luck
As mentioned here I had to delete the folder ~/Library/Caches/Xamarin/mtbs/builds on the Mac used for the builds.
After a rebuild it worked again.
I'm a absolute beginner in programming but I'd love to create my own Apps to make my (and someone else's) everyday life a little easier. I just downloaded the latest version of Android Studio and installed it with all tools.
I wanted to create a "Hello World" App as shown in many tutorials on YouTube. I followed them step by step but there is always this Rendering Problem directly after I finished creating a blank activity.
Rendering Problems
The following classes could not be instantiated:
-android.support.design.widget.FloatingActionButton (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
Exception Details
android.content.res.Resources$NotFoundException: Unable to find resource ID #0x1080029 at ....
I have no clue what the problem could be and how I solve it and all the answers on google and here on stackoverflow.com to a already existing Rendering Problem couldn't help me.
It's a bug in the Android Studio and Android Design Support Library (ver 23.2.0) that is solved in Dev/Canary channel.
For now, if you use the Stable update channel, you have to edit by hand the build.gradle file.
Under Project tool window -> Gradle Scripts open and edit the file build.gradle (Module: app).
Search for dependencies and make sure the com.android.support.design line looks like this:
compile 'com.android.support:design:23.1.1'
Save
Tools -> Android -> Sync Project with Gradle Files
Build -> Rebuild
After Android SDK updated to 6.0 today, I am unable to run my project. The error is:
Gradle 'Alphaets' project refresh failed.
Cause:java.io.FileNotFoundException: ...\project_name\src\main\AndroidManifest.xml(The system cannot find the path specified).
Actually, it should be ...\project_name\app\src\main\AndroidManifest.xml. Part ...\app\... is missing. There is no \src\ folder in \project_name\. That's why AndroidStudio cannot find AndroidManifest.xml.
What causes such an error? How should I revise the gradle file to include the correct path of AndroidManifest.xml?
Besides, my build.gradle(Module:app) did not show up in the GradleScripts any more. I have to go to the absolute path of that file and open it with notepad++. What's wrong with that?
It turns out to be redundant codes in file "build.gradle(Project: MyProject)". I added these code:
dependencies{}
This prevents the file "build.gradle(Module:app)" from being loaded. I did not know the principle, but after I deleting these lines, the project works.
I am also had the same Issue, when I am trying to open existing project.
My problem is related to Facebook resource(D:\GiriBabu_project\CalendarApp-24-08-2016\CalenderApp\app\build\intermediates\res\merged\debug\drawable-mpdpi\some.png) not found.
I just update the existing Facebook-android sdk. then It resolved that issue.
So this issue always regarding to your dependencies. Just find the error regarding to which package in your dependencies and update it.
Another mistake may be your SDK version not match with the in gradle version. so you should change the SDK versions also. (existing projects SDK version numbers not update automatically)
if you don't know the proper version number just create the new project, then automatically know the gradle version and sdk versions.