I have installed Android Studio. When I launch the program, there is the following error.
"Failed to find: com.android.support:appcompat-v7:10.+"
I have checked the SDK manager, Android Support Library and Android are installed.
Maybe my question appears to be stupid but I didn't find any answer.
[EDIT] I changed the
com.android.support:appcompat-v7:10.+
to:
compile 'com.android.support:appcompat-v7:21.0.2'
Now I have more than 400 lines of not found files:
http://pastebin.com/Sa4scRH1
In you build.gradle you have in the dependency section a line containing this string:
compile 'com.android.support:appcompat-v7:10.+'
replace it with this one:
compile 'com.android.support:appcompat-v7:21.0.2'
You are using there a quite old version of the compat library just use the newest one v21.0.2. If this still fails install the support repository from the SDK Manager.
Related
So I was building out a test APK in Android Studio tonight that had to be signed. It failed and said my Gradle was out of date. So I upgraded my gradle from 7.3.3 to the newest 7.5.1
I changed the wrapper setting to distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
and then I changed my build.gradle dependency to classpath 'com.android.tools.build:gradle:7.5.1'
Note that after doing the changes, and restarting Android Studio, it did upgrade the version in the app directory.
Here's the error getting thrown below:
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:7.5.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
Required by:
project :
Note that this was a project from a client, and I did not write this originally. These dependencies were in place, but fairly recent, and the app would build fine with it using 7.3.3. However it wouldn't let me sign my app.
I suppose I could use some wisdom on both of these issues. What I'm going to do is go back to version 7.3.3, build the signed APK again, and copy that exact error to report back here with. It was a gradle version error.
For any any Flutter noobs like myself passing through, this error occured because the Android Tools Plugin version DOES NOT match the Gradle Version:
https://developer.android.com/studio/releases/gradle-plugin#groovy
They match up just vaguely enough in number, that you would think that my line com.android.tools.build:gradle:7.5.1. uses gradle 7.5.1, but instead, Android Tools for Gradle is actually a separate entity, and at 7.3.3 as of typing this reply.
So you CAN set your Gradle to the newest version somewhere else in your project, but it has to match the compatible Android Tools version, which is set here. Its silly and confusing at first, and can easily trip up newcomers. Hopefully the versions diverge enough, or the code syntax changes for some better clarity, but as of now, this is it.
I'm trying to follow this YouTube tutorial for Android Studio, but when I create my project, I get the following error:
class org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager cannot be cast to class org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager (org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader #1824eb4b; org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader #61548dd0)
class org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager cannot be cast to class org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager (org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader #1824eb4b; org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader #61548dd0)
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
AS: 2020.3.1 (renamed version from 4.3)
OS: Linux (Fedora)
Gradle: 6.8
At first, it seems very similar to this issue, but the first two lines of my error are different, likely because my AS version is much newer.
I am positive this has nothing to do with a network timeout.
I tried the solutions on the similar issue, deleting my Gradle wrapper from ~/.gradle/wrapper/dists and then re-syncing the project. While this removed the error, it failed to generate the app directory with the initial project files, and I was left with just the configuration files:
Thus, I'm either looking for a different solution to the dependency cache error, or a fix for the missing project files.
This issue seems to be specific to projects in AS 2020.3.1 that use Kotlin. I could not reproduce with Java projects or AS 4.1.2 (the version used in the tutorial).
Update: Deleting and reinstalling AS 2020.3.1 did not solve the problem, but replacing AS 2020.3.1 with AS 4.1.2 did. Furthermore, after replacing 2020.3.1 with 4.1.2 and then reinstalling 2020.3.1, the project then worked on 2020.3.1. This must be due to a configuration issue with 2020.3.1 that is fixed via the configuration settings of a previous version.
This is a hacky answer without much explanation, but after much hassle, the following solution resulted in a working project.
The problem appears to be caused by a configuration issue with 2020.3.1, and is solved by the automatic configuration that occurs upon opening a previous version of Android Studio.
Delete Android Studio (my install_dir is /usr/local):
rm -rf {install_dir}/android_studio
Download Android Studio 4.1.2 from the download archive
Install and run Android Studio 4.1.2
tar -xvzf android-studio-ide-201.7042882-linux.tar.gz
cd android-studio/bin
./studio.sh
NOTE: If AS fails to run, remove disabled_plugins.txt
Close Android Studio
Redownload (if necessary) AS 2020.3.1
Install and run AS 2020.3.1
tar -xvzf android-studio-2020.3.1.22-linux.tar.gz
cd android-studio/bin
./studio.sh
NOTE: Again here, if AS fails to run, remove disabled_plugins.txt
Create an Empty Activity Kotlin project, and there should be no issues
Android Studio displays in all java files in red : “cannot resolve symbol R” but the project compiles and runs.
I have tried every solution here:
Android Studio "cannot resolve symbol" but project compiles and works, but with no luck.
I tried to :
invalidate caches and restart android studio
delete .gradle and .idea folders
clean and rebuild the project
install a new version of android studio
mess up with gradle file then undo changes and sync project
One thing that I want to try, but I don't know how to achieve, is to reopen the project from scratch as I was opening it for the first time, but I don't know how to do this.
I also tried answers from here:
Android Studio says "cannot resolve symbol" but project compiles,
but again with no luck.
Android studio version = 3.2.1
dependency versions in gradle project file:
classpath 'com.android.tools.build:gradle:3.4.0-alpha01'
classpath 'com.google.gms:google-services:4.0.0'
For some reason that i do not understand ,
this combination of build versions made the issue :
grade version = 4.10.1
classpath 'com.android.tools.build:gradle:3.4.0-alpha01'
when i switched to these build versions :
grade version = 4.6
classpath 'com.android.tools.build:gradle:3.2.1'
The issue was solved !
File -> Close project
Open an existing Android Studio Project
Open you project
Hope it will work.
sometimes, R file is not generated because of package name on android manifest is not match with package module that you have.
Is any wrong syntax or spelling in your xml?
Check your layout or any xml file.
Android Studio seems to have a caching issue with R.java occasionally. I rarely have a problem with this, but when I do, I actually open R.java (double press shift and type "R.java") or navigate to R.java under "app/build/generated/source" directory, opening the file and checking if the relevant XML id has been created. If it has, it forces Android Studio to now recognise the id's that are not being resolved. It's quick to try, and doesn't require clean and rebuild.
From your programs menu, open android studio. instead of opening your project from the recent files, select to open a project from your computer and then locate the path to your project. When all else fails, sometimes this works.
Also, try commenting out the support libraries from your gradle implementation, sync your project, and after sync fails comment them back in and sync again. (not sure if that's what you tried already when you said you messed with the gradle file)
In my case,
I am using
- Android Studio version 3.3.1 at home
- Android Studio version 3.2.1 at office
When i pulled projects to my office computer that are firstly created at my home computer ,
Android Studio can not resolved R file but runs application with no error. Because projects gradle and Android Studio version are incompatible.
Only thing that you sholud do, change the gradle version in project level gradle file
classpath 'com.android.tools.build:gradle:3.3.1'
to
classpath 'com.android.tools.build:gradle:3.2.1'
I was facing same issue,
first thought the issue might because of some xml file or naming of drawable resources incorrectly. After analysing, this case wasn't applicable to me.
So
Updating Android studio from older version 3.2 to newer version 3.3.2 along with new build tool version from SDK manager resolved this issue
for me.
I've tried invalidate cache and Restart AS with clean rebuild all the options but didn't work for me.
It says cannot resolve symbol, but it can run.
In my case, I just reload the needed *.jar files to the libs folder.
File >> invalidate caches/restart
Rebuild Project
Sync
Run
Works for me!
It looks like the library did not load my "imports" properly the first time.
That's why the import methods cannot be seen in my main_activity.xml.
This happened to me when I was going back and forth between different SDK versions.
Apparently SDK manager copied all the source files but it didn't finish cleanly. As a result I could compile and run my project just fine but IDE didn't recognize the SDK and reported all java symbols unresolved.
None of the above and other solutions in SO didn't work for me, but just uninstalling/reinstalling the specific SDK version did a job.
If you renamed your package (inside java folder), make sure you change your Manifest package name to the same
The only thing that worked for me was,
replacing,
import package_name.R
with
import package_name.*
simply go to project settings : settings.gradel and change the rootProject.name to your current name
rootProject.name = "write the project name here"
My Application having native code was running perfect with previous Android Studio version. I just Updated to 3.0.1 and getting this error
/Users/salman.nazir/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/stdint.h
fatal error: stdint.h: No such file or directory
I checked the directory, stdint.h file is there in the mentioned path. Should i need to set something to get that file accessed?
Note: I am using MacOS
I just remove the ndk-bundle (latest version 16) folder from the SDK folder and put there older NDK version (15c). I downloaded the previous ndk version here.
It seems to be problem with the latest NDK. So far, this is the hack for me to proceed.
The error says, that the cross-toolchain (e.g. gcc) cannot find the STL (aka libstdc++6) headers.
A closer look into Android Developer Blog reveals why.
The file in ~/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/stdint.h redirects to a platform header and is not the actual header file.
[Edit]
Here's how to use the new unified headers replacing the platform headers.
And some further information about this topic.
I got the following error message when I was importing a project from github:
Failed to refresh Gradle project 'XXX'
The project is using an unsupported version of the Android Gradle plug-in.
Fix plug-in version and re-import project
This is not a duplicate of this because your get thee error message before
gradle/wrapper/gradle-wrapper.properties
is generated.
The problem appeared after updates. The updated Android Gradle plug-in did not support the outdated version of Gradle I had. But the error message is misleading, if you don't attempt different build options you won't see what the problem is.
After downloading a newer version of Gradle, Imported the project again, then:
Use local gradle distribution
Then Gradle home set to the folder where the new version of gradle was downloaded
that solved it
Edit: From Scott (below comments) : It's preferable to use the wrapper and to change the Gradle version in gradle-wrapper.properties instead of downloading and installing Gradle yourself. As for the Android-Gradle plugin, that's set in the dependencies.classpath block in your build file; see this
I get this gradle-errors in 4 Studio updates! My solution: I copy the Studio-folder, and if gralde throws an error, I copy the old version back. It's not a good way, but until google is not able to deliver an update without producing always the same errors (even if mentioned in many forums), I stay on 4.9 and wait for the first final release.