I am trying to get started with Android Studio
I have installed it on several PCs and have used fresh downloads and I keep getting the same issues:
- Cannot resolve symbol 'fun' or Cannot resolve symbol 'view'. I guess this may be all symbols but these at the only ones I am trying to use now
- Objects do not show up on screen when I am trying to design apps
As I said, I have done this on several PCs now and have tried many steps suggested on SO and other forums (such as Cleanup, Invalidate Cache, adding SDKs, etc) and still get the same results.
Each time these have been clean installs with default settings so I think I must be missing a step or something.
Any advice?
Ta
Make sure your project level build.gradle contain the gradle version same as android studio version
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3' //3.1.3 is the android studio version
}
}
If you are getting "Cannot resolve symbol 'fun'", you might be trying to use Kotlin code in an Android Studio setup expecting Java. You could either change your setup to accept Kotlin or switch to using Java in your project.
The other unresolved symbol "view" probably just needs to be added as an import, you can do this by hovering over it and pressing Alt+Enter to automatically add the class to your imports.
Related
I would like to write a custom gradle plugin that manipulates either com.android.build.gradle.AppExtension or com.android.build.gradle.LibraryExtension. The basic form of the plugin is:
class AndroidLibrary : Plugin<Project> {
override fun apply(project: Project) {
var lib: LibraryExtension = project.extensions.getByName("android") as LibraryExtension
lib.minSdkVersion = "26"
}
}
The problem is that the class LibraryExtension cannot be resolved. That class is contained in "com.android.tools.build:gradle:7.1.2". Note, there is no problem accessing either of these classes in a gradle.build.kts script file. I just can't access either of those classes from within a custom plugin like seen above. I've tried adding a dependency to com.android.tools.build.gradle 7.1.2 in the build script, but that doesn't work. I also tried adding it as a buildscript dependency, and that didn't help either. I also got the
com.android.tools.build:gradle jar file and added it as a dependency, but that too didn't work.
It seems to me to be reasonable to expect a custom plugin of being able to manipulate the android build settings but I just can't find a way to resolve either LibraryExtension or AppExtension from within the custom plugin project.
If someone knows what I need to do to resolve those two classes, that would be greatly appreciated. I'm currently under the impression, that this is an architectural limitation of with android's gradle plugin and that I really can't access the "android" build section using LibraryExtension or AppExtension from a custom plugin and dsl. If that is the case, that too would be useful to know.
check this answer for your question, it is gonna solve your problem.
Initially I was building the plugin using IDEA. I could build the project by using a "gradlew build" command. I noticed that I would get the following message whenever I tried to sync the project:
This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 2020.1.1 or newer
I had been ignoring that issue since I could successfully build the project using gradle commands. Here's a link the explains what the message means: https://intellij-support.jetbrains.com/hc/en-us/community/posts/4405168877202-This-version-of-the-Android-Support-plugin-for-IntelliJ-IDEA-or-Android-Studio-cannot-open-this-project-please-retry-with-version-2020-3-1-or-newer-
One of the suggestions to this problem was to build the project in Android Studio instead of waiting for IDEA to incorporate later android build. I did that and that indeed fixed that issue. The additional side effect was that I could now build the plugin. I was able to add dependencies for both gradleApi and to com.android.build.gradle and was able to resolve AppExtension of LibraryExtension. I had added the same dependencies I when I was using IDEA IDE. I had been customarily building my custom gradle plugin using IDEA. This was my first custom gradle plugin that I was going to manipulate an "android" build configuration.
In Kotlin files when I have multiple errors, Android Studio becomes unusable.
When I make any change everything freezes for a few seconds, when I disable code inspection then it works normally.
This does not happen with java
Is this an issue with my pc or Kotlin or android studio, and is there any kind of a solution
Did you update your kotlin version?
I passed over a similar problem because of updating some implements or kotlin,google-services version etc. in the middle of a project!
After i returned the previous version; it is fixed...
So try using previous version for example kotlin_version = '1.3.40' in the project's build.gradle.
buildscript {
ext.kotlin_version = '1.3.40'
...
...
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
...
It might not be an issue with Kotlin.
Ensure that both the Kotlin plugin and Android Studio plugins are up to date.
The IDE can hang if it does not have enough memory allocated.
To change the memory allocation, go to Edit -> Edit Custom VM option and update the memory allocation as shown in the image below. This might help.
If you need additional assistance finding this setting, please refer to the official Android Studio Configuration guide.
Just install new android studio 3.0 and I cannot find google cloud endpoint in android studio module.
Please how to set up Google Cloud Endpoint with the latest android studio 3.0
In This link the Read.MD That is Provided By GoogleCloudPlatform specifically for endpoints-framework-gradle-plugin has a few modifications due to issue they have found ... It Worked For me as i had the same issue , do the modifications until this line "If you have a particularly complicated buildscript classpath bringing in a lot of dependencies with cryptic error messages like"
clean and build your app and try to run your backend module
here is the link : https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin/blob/master/ANDROID_README.md
you might face an issue of jsr305 or so ...
add configurations.all in your build.gradle (app) as below
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
you might another issue called
Can't start process working directory ............................. exploded-app folder doesn't exist
in order to solve this
modify the backend/backend.iml
Change:
<option name="WAR_DIR" value="$MODULE_DIR$/build/exploded-app" />
To:
<option name="WAR_DIR" value="$MODULE_DIR$/build/exploded-backend" />
if you faced anything let me know i have been going through hit and miss so i faced some issues that might occur to you
note: check the "Android Studio" section specially the "Run" part because it's telling you that you need to run the local development server using the gradle task appengineStart which starts the development server in non-blocking mode
I've been working on an android app in Android Studio 3.0 canary 6 on another computer and using Github so that I can work on the project from any computer. Unfortunately, 3.0 doesn't scale correctly on my Surface Pro 4, so it is unusable. When I load the project in 2.3, I get an error that says something along the lines of "this gradle version requires Studio 3.0". I have tried tinkering with the gradle version in 2.3, but to no avail. Is it at all possible to totally convert the project for use in 2.3 (permanently; I would have no need to use 3.o again. I was just playing around with it.), and if so, how would I go about doing that? Thank you!
Yes, you can do that.
From 3.0 to 2.3.3 you must do the following changes:
Open your project on the Android Studio 2.3.
Expand Gradle Scripts, open gradle-wrapper.properties file and change the final piece of distributionUrl attribute to /gradle-3.3-all.zip . This may vary depending on your 2.x version.
Next, open build.gradle(Project: YOURPROJECT) and change the classpath inside dependencies {} to 'com.android.tools.build:gradle:2.3.3' . In repositories {} that is inside buildscript {} change google() to maven {url 'https://maven.google.com/' name 'Google' }. You should do this same thing to allprojects {} that is found just below dependencies {}.
Finally, open build.gradle(Module: app) and inside dependencies {} change the word "implementation" to "compile". Now sync your Gradle.
These changes will make the error you found, regarding the IDE version, to stop showing. You'll probably have other errors popping up that are related to sdk and dependencies versions. Just adjust the versioning of the sdk and dependencies to the ones that are used by your Android Studio 2.3. Some XML files may also show errors and you must manually correct those.
enter image description here
I have buy new macbook and I download android studio when I start new project its stock in build ..... Gradle project info
android studio last version 2.3
I try gradle work offline in setting and the same
OS X 10.9.5
java 1.8 (121)
android studio only show Building My Application Gradle project info
Thank you
According to this you may just be experiencing a slow network connection. WHen a project is created for the first time there is a lot to be downloaded, and it can take a while on slow connections.
ACcording to this you may be using the wrong version of android studio. If you navigate to the folder where you have Android Studio's files, look for "studio.exe" and "studio64.exe". First though, close the current open Android Studio window. Start by selecting "studio64" and opening it. Create a new project and see if it gets stuck. If it gets stuck, try with "studio.exe" and create the project again. If it gets stuck agian, try a different solution.
And according to this you could try pressing "cancel" and finding your build.gradle on project-level. IN there you will find something like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Replace 2.3.0 with an earlier version, e.g. 2.0.0. Then press (in the menu bar at the top) build>make project. Gradle will start to build should in theory finish.
If none of these work, leave a comment so I know and can look for other alternatives to these