java.io.filenotfoundexception for AndroidManifest.xml - android-studio

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.

Related

Android Studio Gradle Could not find gradle-7.4.0.jar

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.

Android studio sdk does not contain any platforms

I downloaded Android studio from their website for windows. It contained 790 Mb. But there is a message shown like
SDK is missing
I followed answers for this issue of missing android studio SDK in here. But my problem is not solved yet.
I have another problem. There is a message shown
SDK does not contain any platforms
when I chose the SDK location by going to configure > project defaults > project structure.
May be some files are not downloaded,try again with your internet connection.It will ask to download some additional files, press allow.
this problem faced by almost everyone due to network problem .
You can easily resolve this error. I suggest you ,if any of your friends already installed android studio then copy sdk from him/her and paste into your sdk path and don't forget to delete sdk.
In this process ,your internet should work so that rest of the things it can download .
this is the best and easy way to resolve sdk error.After that you can download platform tools easily by going to settings>>Android sdk>> sdk tools.
Open the SDK Manager to download the NDK bundle.When your download completed, maybe there'r two different folders you have. One is ndk-bundle the other is ndk/22.0.7026061(the version you choose to download). And just use the behind one
As the log said before. Make sure you have config the ndk.dir in local.properties or the system global path variable.Or you also can open the project structure dialog to choose the Ndk location.Still use the behind folder( ndk/22.0.7026061).
If you have config it and still have the same problem.you can use the SDK Manager to download the NDK lower version one(like 21.0.6113669).Cause it may not match to your AS version
Then repeat the step two
That's work nice for me

Getting "Gradle sync failed: Please use JDK 8 or newer" under version 3.3

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.

"com.dsi.ant.plugins.antplus.pcc does not exist" error for ANT+ in Android Studio 2.1.3

I am trying to use the runnerup project but I get the below error. My Android Studio is 2.1.3:
I am adding one more thing, I have faced same problem and fixed by downloading below source code via below github link and placed on ANT-Android-SDKs folder (if folder is empty).
https://github.com/ant-wireless/ANT-Android-SDKs/tree/c35bcf8ee9b6379e405693dbd6bec506ec533669
I believe you do not have the correct ant+ library
For the runner up project you need to make sure that you have the code pointing towards the correct .jar file. In this case I do not think it is picking up the ../ANT-Android-SDKs/ANT+_Android_SDK/API/antpluginlib_3-1-0.jar in your hrdevice build.gradle.
dependencies {
provided files('libs/samsung_ble_sdk_200.jar')
compile files('../ANT-Android-SDKs/ANT+_Android_SDK/API/antpluginlib_3-1-0.jar')

IntelliJ unable to recognize groovy String

I am using IDEA - 11.1.1 and gradle - gradle-1.0-milestone-9 (I tried with release candidate 3 also) on windows-7 (if this matters)
After importing gradle porject, IDEA complains about String object. I think I am missing something about grrovy configuration. I have also marked - main and test folder as Sources and Test Resources respectively. Did I miss something obvious?
Most likely the JDK isn't set correctly in IDEA. Go to File -> Project Structure -> Project and check/fix Project SDK.
Try checking your project and module sdk.
On your module select F4 or Right click "Open Module Settings"
Check your SDK and Moduel SDK
I am sure that will resolve your problem.
Check your IDEA project settings and look if your JDK is configured properly.
I suggest you use the gradle idea plugin to create your IDEA project files, instead of using the import function of existing gradle projects into IDEA, since from my experience it gave me troubles. Also adding new jars via gradle and updating your IDEA project files via gradle seems more consistent.
I uploaded a build.gradle gist, which might give you a good start:
https://gist.github.com/1580234
It contains some explanatory comments.
Greets,
Jan

Resources