Sync Project with Gradle Files - android

I've recently downloaded the Android Studio Bundle v0.3.2 for Windows, and now trying to complete the Google Maps Android API tutorial. There is a step which require to Click Sync Project with Gradle Files. I can't seem to find this button anywhere in Android Studio. Just in case here is a link of the Google Maps tutorial: Set Up Google Play Services SDK.

The Sync Project with Gradle option was added in Android Studio 0.4.0 and Android Studio is now on version 0.4.2 - make sure to check for updates within Android Studio (on Windows, it is the Help menu, then Check for update...)

There is a useful shortcut Ctrl + Shift + A, after which a window appears and you can type some command that you would like IntelliJ to run. Just type "sync" in there and it will find that command Sync Project with Gradle Files, even if it's not visible in the menu.

Related

Cannot run my app, asking to select Android SDK

Today I've installed Android Studio Canary 1
Now I cannot run my app. This following dialog appears.
I've already set the right SDK location through File-> Project Structure-> Android SDK location.
Expecting your help to solve this problem.
Warning Dialog image:
Go to project structure settings and set Source Compatibility and Target Compatibility to your current java development kit version:
Just you need to sync your project file with your gradle file.
File -> Sync Project with Gradle Files
I tried every answer in this post but my problem only got resolved when I made these steps:
File -> Close project -> Remove project -> Open existing project (same
project)
Maybe this will save a morning to another person with the same bug.
EDIT
This happened to me a lot on a MacBook. After I posted this answer it just kept happening so what I did was:
uninstall the Android Studio version I had from the App Store;
download the desktop stable version from Android Studio website;
start using the desktop version of Android Studio.
Never happened again.
Sometimes the SDK path will be incorrectly configured. You would need to fix it.
To Settings/Preferences( command + , on mac).
Search for SDK
Under Android SDK, click on edit and point it the root of sdk directory on your file system. (If ther is no SDk installed then install in from the below list).
i suggest you go to build.gradle and sync again.
Or Tools -> Android -> Sync Project with Gradle Files (Android 3+)
You need to insall SDK api 19 check this out.
https://developer.android.com/studio/releases/platforms
Go to sdk manager and install sdk according to your device and check your device api. Example if your device is jellybean then install api 19 sdk.
Go to Tools> Android > SDK Manager and make sure you have selected default Setting under System Setting. In this image I have selected Android 7.1.1 as default SDK
Just click on the button ..."Sync Project with gradle file"
Error will be remove
I had the same problem and what it worked for me was just sync with gradle.
I just did what I've found in this similar question:
How do I "select Android SDK" in Android Studio?
The original answer:
go to build.gradle and click sync now. Then it worked.
Update :
File -> Sync Project with Gradle Files (Android Studio 3.1.1)
Tools -> Android -> Sync Project with Gradle Files (Android Studio
3.0.1) Or You can click on the icon from the toolbar.
Sync Project Icon
This answer may not help works for later version as Android studio Team work on making the tool more better, the way to sync may be
different in the next version of Android Studio.
COMMON WAY that may helps is try to sync project and then Invalidate
Caches and Restart Android Studio.
Solution for Android Studio 3.1.2
Before that, by the way, I had invalidated cache and restarted too, but it didn't work.
Please, try and let us know.
P.S.
I had this problem after I imported a project from Git, just in case someone would like to replicate.

Not able to find the Rebuild option in Android Studio under Build Option

I am using Android Studio 1.5.1 on windows 7 .I am not able to find the rebuild or clean option under the "Build" option?Is there any command to force rebuild or do it form the Android GUI?
The project was built in Eclipse and I have imported it in Android Studio.Earlier I was getting some error from google Play services which I have resolved by commenting the below line in the project.properties
target is android-23
android.library.reference.1=../../../../workspace/google-play-services_lib
Maybe there is something that you need to update before continuing to develop your project. Check on Help -> Check for Updates...
You should always keep Android Support Repository, Google Play Services, Google Repository, Android SDK Tools and Android SDK Platform-Tools updated.
I also encountered this problem and my Android studio was also latest version. As a workaround for this problem what I did was to open the module settings and changed values and reverted back to old values and click ok. After that those missing menu items appeared.

Android Studio refuses to accept that Google Repository is installed

I am trying to get AdMob running. But for some strange reason, I can not get Android Studio to accept that the Google Repository is installed.
Thing is, it is installed in the SDK manager. And reinstalled multiple times now. Project Structure SDK path is the same as in Android SDK Manager.
When I mouse over the compile 'com.google.android.gms:play-services:6.+' line in my build.gradle, I get this tooltip:
"Dependency on Play Services, but the SDK installation does not have the "Extras > Google Repository" installed. Open the SDK manager and install it"
When I try to compile, this error:
Error:Failed to resolve: com.google.android.gms:play-services:6.+
With that error comes a link to install the Repository, which I used multiple times now. Android Studio does not care. Help.
edit: When I use a fresh empty project, it works, and Android Studio finds the Repository. No clue what is going on here.
I was suffering with the same problem and finally found a simple solution (I'm using Android Studio 1.5.1 on MacOS):
Go to File --> Project Structure
On the left hand of the opened window, under Developer Services, select Ads
Check the checkbox next to AdMod. Your window should look like this:
Click OK
This will add the required dependency to the Android's build.gradle, and sync Gradle.
When the sync is done, and just to make sure, clean and rebuild your project:
Build --> Clean Project
Build --> Rebuild Project
That's it! I hope this helps.

Android studio - Invalid App-Engine SDK Path

I am trying to run my first android application in Android studio. Application created successfully with new project vizard but cant run that as getting this error--
Invalid App-Engine SDK Path
Please help
All answers about disabling the plugin are incorrect.
You need to execute ./gradlew appengineDownloadSdk in the root of your project. Alternatively you can execute the task via the gradle sidebar in Android Studio.
This task will create the folders given the current versions in your build.gradle file. You have to run this when you update versions in your dependency list.
One solution is to disable the Google Cloud Tools for Android Studio plugin.
In Android Studio, click on:
File > Settings
Then click on Plugins (on the left), and uncheck "Google Cloud Tools For Android Studio". Then Apply.
It asks you to restart Android Studio. Click on Restart and it will work now.
Seems like this is the problem--
exception in plugin Google cloud tools for android studio
After disabling this plugin its working now!!
In other scenario if you want to setup Google app engine this might help
https://stackoverflow.com/a/20986031/472336
I've created folder
c:\Users\[user_name]\.gradle\appengine-sdk\appengine-java-sdk-1.9.18\
And copy sdk that download there
https://cloud.google.com/appengine/downloads
So currently project compiles and works for me

android studio 0.4.2 + gradle + Android Source code

I'm trying to attach the android source code to my gradle project using Android Studio. The problem is that the SDK tab does not appear if you are using a gradle project and I can not attach the source code. I tried with version 0.4.3 and does not work.
Any idea or work arround?
EDIT: I've attach a capture with my project structure without sdk option.
Thank you,
The short explanation is that Android Studio has added some functionality to try to automatically manage IntelliJ SDKs; if you give it a JDK path and Android SDK path in Project Structure > Android SDK, it will automatically create a Java SDK and Android SDKs for each API level you have installed in your Android SDK. The problem is, if it creates an Android SDK for an API level that doesn't have the sources downloaded, if you go into SDK Manager later and download the source, it doesn't pick that up and update its SDK. I've filed https://code.google.com/p/android/issues/detail?id=65230 for this. In that bug I list two workarounds, which I'll explain here:
You can actually get at the SDKs panel you're looking for. We hide it if you have a Gradle-based project open since we want Gradle-based project users to not have to worry about it, but since we also support IntelliJ-style projects that use its internal builder, it's still possible to access it so those users will be able to make their projects work. You can get at this panel if you access Project Structure without a project open. To do so:
Close all open projects
From the Welcome to Android Studio screen, go to Configure > Project Defaults > Project Structure > SDKs
Choose the appropriate Android API SDK that you installed source for, and go to Sourcepath panel
Press the + button, and choose the source directory.
If you're having trouble following that, let me know and I can post screenshots.
Another approach would be to blow away all of Android Studio's auto-created SDKs and let it rebuild them. To do that
Exit Android Studio
Delete the jdk.table.xml file, which on MacOS will be in your home directory under Library/Preferences/AndroidStudioPreview
Relaunch Android Studio
Go into Project Structure (either from the Welcome screen or from a project), and choose the Android SDK tab
Make sure the Android SDK location and JDK location are correct.
Check the compileSdkVersion in your build.gradle file and download the "Source for Android SDK" for respective API from Android SDK Manager.
SDK manager icon will be available on Android Studio tool bar.
Nothing else needs to be done.
Note : Source Code for Android SDK is only available for and after API 13 .

Categories

Resources