How to get Eclipse code completion back after switching target to GoogleAPIs? - java

In order to make use of Google API GeoPoints in my Android app, I just changed the application target from this:
# In project.properties
# Project Target
target=android-8
to this:
# In project.properties
# Project Target
target=Google Inc.:Google APIs:14
After changing the target to Google APIs, it wasn't long before I noticed that code completion wasn't there anymore. Anybody know if it is possible to get Android API code completion when targeting Google APIs?
Update:
Just tried again and now I am getting code completion. Strange...

right click on project folder, go to properties, select android. set project target to 14 from 8.
restart eclipse if needed.
Check min sdk version in manifest file (it should be 14, if not make it),
then project or default.properties (change as you wrote in your question, if not there)

Related

Android SDK is not specified in multi-module project

I cloned a multi-module project from the Github with the following structure,
It has 5 modules like android, angular-client, design-impl, hub-spot-email and lastly, loan-calc-service. The moduels hub-spot-email, and loan-calc-service are the Spring boot app. When I tried to build at the first time, I get the pop-up to set the output path for the project,
Then, I have set the hub-spot-email/controller package as the output path (endpoint). This is the path set for the project,
/Users/Somename/IdeaProjects/eclipxgroup-master/hub-spot-email/src/main/java/com/quotecrunchers/email/controller
I have tried again to build and I get the error,
Error:Android Source Generator: [eclipxgroup-master] Android SDK is not specified
I have installed the Android SDK. The installation setup is correct as I checked earlier. In the next try, the error doesn't go away. I assume I need to set some path for the android module. I went to the preference section which seems like,
Also, the Java SDK is properly set though I get the error sings to the left of the files,
While I have some experience with the java and Spring xxx, I couldn't figure out what I need to do to build the project. Do you have more information what I need to do?
Note
So far I only managed to set the Android SDK for the project.

Android Gradle's dependency cache may be corrupt and gradle build not working

I am trying to import this project, even I tried to import other few projects too, I am getting below error.
https://github.com/ashdavies/data-binding
I have spent my 5 hours on it, even I tried many solutions on google but nothing gonna worked for me.
I tried following solutions, nothing worked.
1) delete .gradle directory
2) Restart IDE,
3) I tested with com.android.tools.build:gradle-experimental:0.7.0-alpha1
I am frustrated because of this Gradle and these issues.
Gradle Version : Gradle-2.13, I do not want to change this version.
Android Studio Version : Stable 2.1.1
Note : My other project is working fine and I can build it too.
You can try different workarounds for this problem :
1- Clean project and Rebuild it.
2- Before importing the project, remove the contents of the Build folders.
Then replace the contents of your gradle-wrapper.properties file with the following lines, to make it use a local distribution for building the project :
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=file\:/opt/gradle/gradle-2.13-all.zip
in which, the last line prevents android studio to download or use a corrupted gradle cache.
Go to any browser
type gradle and press enter
you can specify any version you want after the
gradle keyword
i am downloading gradle 3.3
https://services.gradle.org/distributions
click on this link which is in description directly if you want
click on gradle 3.3 all.zip
wait for the download to complete
once the download is complete
extract the file to the location
c://user/your pc name /.gradle/wrapper/dists
wait till extraction it takes 5 mins to complete
Now open your project in android studio
9.go to file > settings >bulid ,exec,deployment > gradle
now change use default gradle to
use local gradle distributn
select the location where you had extracted gradle 3.3.zip
C:\Users\your pc name.gradle\wrapper\dists\gradle-3.3
click on OK
Now build starts again and
you can see now the build is successful and error is resolved
or
watch tutorial
https://www.youtube.com/watch?v=u92_73vfA8M
In my case, it was happening because i haven’t set the JDK path in environment variable.
Please check from your Android studio studio that your JDK path is correct.
Go to Project Structure> SDK Location and check JDK Path. Give it the correct JDK path and also set the JAVA_HOME environment variable.
You can try this solution as i was facing this issue showing Error2 Gradle's dependency cache may be corrupt and gradle build not working and resolved it. Already answered this question on stack. You can reffer to this answer link
It includes firstly downloading latest graddle version from official site then replacing that unzipped file with home/yourUser/.graddle/wrapper/dists containg older version file on Mac.
Because your gradle path for project is incorrect.
Go to
->Settings
->Gradle
and select "use default gradle settings"
and than sync project. and issue will be resolved.
delete .gradle, .idea and gradle folder from the project and then invalidate cache and restart.
problem will be resolved.
Thanks :)
Sometimes it's a cache issue and sometimes due to interruption in download.
Step 1:
Try to download gradle distribution manually
https://services.gradle.org/distributions/
and then go to project settings -> gradle -> and use the file which you've downloaded
Step 2:
If step#1 still not working, then it may be a cache issue. If you are a mac user, go to your finder user folder, show hidden items by pressing [Command + Shift + .] , Go to gradle folder and
In my case is that gradle-5.1.1-all.zip download failed, so I go to zipStoreBase+zipStorePath(configured in gradle-wrapper.properties, eg: E:\gradle-home\wrapper\dists), and delete the gradle-5.1.1-all directory, and let android studio to download that zip file again.

Android Studio doesn't recognize JDK

My Android Studio suddenly stopped recognizing JDK. it starts fine with no error messages.
I have JDK 1,7 (x86 version) on windows 8.1. Environment variable is defined in the system variables and I can run java -version command from cmd with no issue.
following screen shot describe the problem clearly:
You may need to check if both JDK and SDK are set correctly.
In the current project:
Go to File > Project Structure..
Explore the sections "Android SDK
Location" and "JDK Location" (Put the complete paths)
Click OK to save changes
For projects default:
Close current Project (File > Close project)
Click on Configure > Project Defaults > Project Structure
Explore the sections "Android SDK
Location" and "JDK Location" (Put the complete paths)
Click OK to save changes
Restart Android Studio and try again.
Screenshot: http://i.imgur.com/0OD8OeJ.png
(I cannot post images directly)
After spending one night trying to solve this problem, i just did as suggested by yole
So Simple :
File ----> Invalidate.
I had the same problem after upgrading to build tool 22.0.1.
I solved this issue by removing dependencies and adding it again like app-compact and play services.

Installed Android Studio 0.8.1 but can't get into IDE since no Android SDK

I installed (after unzipping) android-studio-ide-135.1224218-windows, hoping to be up and running a "hello world" program by now, but the IDE won't even start because "Your Android SDK is missing, out of date or missing templates." It tells me "You can configure your SDK via Configure | Project Defaults | Project Structure | SDKs" but when I do so, I see NOTHING in the text box for Android SDK location.
I searched for "android sdk" on my computer, and found C:\Program Files (x86)\Android\android-studio\plugins\android\lib\sdk-common.jar, but when I put that or C:\Program Files (x86)\Android\android-studio\plugins\android\lib into the text box, I get NO ERROR, but then I get the same message, and when I come back to the text box, IT DOESN'T HAVE WHAT I PUT INTO IT.
If I browse for the text box location, no matter what I put in, it says "Please choose a valid SDK directory".
That's the only "android sdk" on my computer.
I JUST installed Android Studio to C:\Program Files (x86)\Android\android-studio with no errors.
I have C:\Program Files\Java\jdk1.7.0_60 as JDK location. It won't let me change it to C:\Program Files (x86)\Java\jdk1.7.0_25.
I've Googled to see if I can download an android sdk from somewhere but found nothing.
WHAT DO I DO? I can't get into the IDE to try stuff.
sdk-common.jar is not the 'sdk' that Android Studio is looking for. You must download the sdk from SDK Manager and put it in the directory C:\Program Files (x86)\Android\android-studio\sdk.
This is what the sdk should contain:
sdk\build-tools
sdk\extras
sdk\platforms
sdk\platform-tools
...
I couldn't make use of the Answers above, so I uninstalled and then brute-force deleted EVERY trace of Android EVERYTHING.
Then I downloaded and installed installer_r23-windows.exe, putting the SDK manager out there BEFORE installing the Android Studio IDE. I allowed the default path: C:\Users\Dov\AppData\Local\Android\android-sdk.
Then I downloaded and installed android-studio-bundle-135.1245622-windows.exe--NOTE: BUNDLE, NOT IDE. I used the default folder: C:\Users\Dov\AppData\Local\Android\android-studio.
And I STILL got the SAME ERROR. But at least THIS time I could go into SDK Manager, as the error message said to do.
What I found was that the CORRECT path to the JDK, which was the same path shown in the SDK Manager dialog for installing packages. So why the error?
LOOOOOOONG story short... as I tried to browse for the path, I noticed that the AppData folder WAS NOT SHOWING.
SOLUTION: TYPE THE PATH BY HAND. It worked.
I CHANGED NOTHING, except my approach.
As it happens, "The [AppData] folder is hidden by default in File Explorer, and has three hidden sub-folders: Local, LocalLow, and Roaming." See here.
I assume that was Android Studio's problem, but why typing it by hand changed all that is anybody's guess.
I guess it's not a great idea to have AppData part of the DEFAULT install path.
(BTW, I did NOT have to mess with ANY environment variables.)
=== EDIT ===
I reinstalled Studio and SDK Manager and the above did not work. What I did BOTH times was to TRY to drag the SDK Manager.EXE file into the browse dialog from an Explorer window; it didn't work either time, but I tried today and THEN found success.... So I guess this seems to be a necessary step.... I also added \ after sdk in the text box for the SDK path.... And I clicked Apply before OK.... I hate when stuff works seemingly randomly.... Just trying to save others the frustration. Maybe Google needs to address this.
I had exactly this problem. After downloading Android Studio from the developer site:
android-studio-ide-135.1538390-windows.zip
But kept getting the error: "Your Android SDK is missing, out of date or missing templates."
Wasted several hours, but eventually went to the "Installing the Stand-alone SDK Tools" page:
https://developer.android.com/sdk/installing/index.html?pkg=tools
And downloaded and installed installer_r23.0.2-windows.exe.
Then I added its location to Configure -> Project Defaults -> Project Structure
I can now create projects.

Android Eclipse Classpath - want to add classpath container path but eclipse won't let me

I'm using Eclipse to learn to develop Android applications in Java. I haven't used Eclipse before.
The project I'm trying to use (supplied by OReilly as part of 'Android Application Development') is MJAndroid. When attempting to run the project, the Run fails, and the Problems tab mentions com.java.Object can't be found, and Eclipse asks me to check the build path. Clicking
Properties -> Java Build Path -> Libraries, the message 'Unable to get system library for the project' is displayed.
On a working project, Properties -> Java Build Path -> Libraries has an entry for Android 1.1, which if I click Edit, has the classpath container path of com.android.ide.eclipse.adt.ANDROID_FRAMEWORK.
It seems a simple matter of adding the correct container path to my non-working project. However Eclipse seems determined to make this as difficult as possible. No matter what I chose to add - jars, externals jars, variables, libraries, class folders, external class folders, nothing seems to take the form of 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK' that the 'Android 1.1' entry on the working app has.
How can I add this namespace to my project so it resembles the working one?
I'm quite sure it's a problem with Eclipse's somewhat odd user interface. Frankly there' nothing I'd prefer more than a file to modify and set such information - my background is in Python, and the whole eclipse environment seems an unnecessary burden.
I had faced the same issue when I imported a sample code downloaded from the internet. I am using android sdk 1.5 with 0.9 ADT plugins. Here is a simpler way to fix the andoid library reference issues
Right click on the project which has
issues and select properties
Select the appropriate Android build
(1.1, 1.5 or 1.5 with google api) and
say ok
Again right click on the project and
select "Android Tools > Fix Project
Properties"
Fix the imports once (if required)
Refresh the project and you should be
ready to go without any manual
editing
I faced this same problem after importing a project through GIT. The problem was that I didn't have the same target android platform installed, and the build path somehow got corrupted.
The first obvious thing i did was changing the target sdk in the project.properties, but even after cleaning up the project and Android Tools > Fix Project Properties, it didn't help and I was still getting the build error.
My solution after wasting close to 1 hour trying to figure this out?
RESTART ECLIPSE
Everything worked fine after that. Eclipse is pretty fickle. Only through years of experience you'll then understand her well. :)
Had the same problem and it turns out the Android SDK Location was not set which was a really simple fix. Go to Window->Preferences, click on 'Android' on the left hand menu, fill in the location of the Android SDK (e.g. C:\Program Files\Android\android-sdk) and click OK. Everything worked fine for me after that.
Found the answer in this set up guide: http://developer.motorola.com/docstools/library/Installing-Android-Dev-Environment/
Sometimes Eclipse can get a bit funny (technical term) with classpath container resolution.
You have a working project in your workspace, so you can rule out plugin installation issues. You could try opening the .classpath file (hidden by default, select the triangle in the top-right of the Package Explorer view, select Filters... and uncheck .* resources) and manually adding the container declaration.
`<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>`
You may then have to close the project and open it again (right-click->Close Project) before Eclipse recognises the change.
You may also find that there is an Android builder and/or nature. If you compare the .project files for the working and non-working versions you may see entries for Android builders/natures. Copying the relevant entries may resolve the issue.
sometimes, eclipse can help you.
In Android projects, click right button on the project-> Android Tools -> Fix Project Properties.
It's usefull in class path errors!!
Luck!
I would verify you have the correct version of Java installed as well as the Android SDK. I would recommend installing/reinstalling the ADT plugin in your eclipse, makes it alot easier to create the android project.
http://developer.android.com/sdk/1.5_r2/installing.html
Also. I guess the path of the Android SDK must be setup correctly. This happened when I was overloaded with projects and I decided to create a new workspace copying some existing stuff into it.
Seems that the new workspace requires you to setup these details too once again
Is that setup properly?

Categories

Resources