I just installed new eclipse version Neon Release 4.6.0, and downloaded sdk manager from there I downloaded all things but still can't find appcompat on: android-sdk-windows\extras\android\support folder..
I read alot of posts they are saying that you have to go on support folder but I have no support folder I just have :
> D:\Eclipse\android-sdk-windows\extras\android\gapid
> D:\Eclipse\android-sdk-windows\extras\android\gapid_3
> D:\Eclipse\android-sdk-windows\extras\android\m2repository
And my problem is when I create and Android Application I see errors on:
extends ActionBarActivity
and there is red lined this line too:
import android.support.v7.app.ActionBarActivity;
and alot of other lines in project for examplre R.fdf.dfd
Any idea how to import that library to may workspace and work ?
I found some files but cant make my project work I found them here :
\android-sdk-windows\extras\android\m2repository\com\android\support\appcompat-v7
Related
I have downloaded the CustomView.zip from developer android page.
I've tried to import this into Android Studio 2.2.0.12. But I am NOT able to do it.
I have also tried to create a empty project in order to import only the sources and XML. It does´t work either, I get a lot of duplicates XML definitions and even after resolving the duplicates the App crashes with some inflate exception.
So, i´m wondering, How can I import this into Android Studio in order to have a working project and run it to see the behavior and also to debug it
Thanks in advance.
Looking at the sample file, stupidly, it doesnt include any of the standard android framework files (gradle, manifest etc), so Android Studio will not be able to automatically import it.
To get round this you should create a new blank project, leave the mainactivity that is generated.
Then go in to the file structure of the new project and copy in the files from the sample in to the corresponding files. Make sure you overwrite the files in the new project.
Then go in to the code base in Android Studio and delete any imports that cant be found due to incorrect package names. Re import these (alt + enter on mac) with the correct package names and then build and you should be good to go.
I'm having difficulty getting Google Cloud Endpoints working. I have an Python endpoints project running on GAE and it works perfectly using the api explorer. However I'm struggling to properly generate the client library and use it in my android app. I've tried a number of sample projects and have the same problem every time; I can't import and use the model classes from the client libraries.
Here's what I'm doing (for this example I'll use the helloworld api python sample at https://github.com/GoogleCloudPlatform/appengine-endpoints-helloendpoints-python)
Unzip the sample code
Generate the client library by navigating to folder and running
<gae-sdk>\endpointscfg.py get_client_lib java helloworld_api.HelloWorldApi
Unzip the generated folder and copy into root of project in eclipse
In Eclipse add "your_app_id_appspot_com-helloworld-v1-20140310110152-java-1.17.0-rc-sources.jar" to build path (Right click the JAR> Build Path>Add to Build Path)
At this stage, I can import com.appspot.your_app_id.helloworld.model.*but I cannot import com.appspot.your_app_id.helloworld.model.Greeting
Can anyone shed any light on what's happening here? I have tried many different ways to get this to work but have the same problem every time.
Many thanks,
Tom
The problem is that by default, the generated zip file only contains a sources jar, not an actual compiled library jar which your Android app can use.
Here's the solution:
In your backend api folder (from the same place where your app.yaml is located), generate the client library as a gradle library, like so:
<gae-sdk-path>\endpointscfg.py get_client_lib java -bs gradle helloworld_api.HelloWorldApi
You'll now have a helloworld-v1.zip. Unzip this (either right here or in somewhere convenient like ~/temp)
This will create a folder called helloworld, which should have a build.gradle in there along with a src folder.
Build your client library using "gradle install" in this folder.
Copy build/libs/helloworld-v1-1.X.X-SNAPSHOT.jar into your Android app's libs folder.
Add it as a library in Android Studio by right-click/add-as-library.
Your classes should now resolve correctly.
Step 4 should install the just-built client library into your local maven repository. You can follow the instructions in readme.html in the helloworld/ folder you extracted to integrate directly with your Android app's gradle build system instead of copying the jar your built manually.
This post said that there is a bug with Android Studio's Add As Library: Android Studio: IncorrectOperationException when 'Add as Library' is clicked whilst trying to configure Google Apps Endpoints client libraries
Not sure if it applies to Eclipse.
I was able to solve this problem and have provided the solution below.
I switched to Android Studio Preview 0.4.6 from Eclipse which helped get rid of some of Googles library import issues(through I guess build.gradle config). I feel it was not a problem of Eclipse which I was using earlier.
I was able to to fix the import issues. The code on the tutorial segments on the official Google docs needs to be put in sync.
The solution is to roughly do the following changes:
In MainActivity.java, replace:
HelloGreeting with HelloworldApiGreeting
In MainActivity.java, add the following at the top:
import android.widget.Toast;
import android.os.AsyncTask;
import android.util.Log
import com.appspot.androidbackend1.helloworld.model.HelloworldApiGreeting;
import com.appspot.androidbackend1.helloworld.model.HelloworldApiGreetingCollection;
In MainActivity.java, comment the following at the top:
import com.appspot.androidbackend1.helloworld.Helloworld.Greetings.Multiply;
import com.appspot.androidbackend1.helloworld.model.HelloGreeting;
In Application.java, add the following at the top:
import com.appspot.androidbackend1.helloworld.model.HelloworldApiGreeting;
In Application.java, replace:
HelloGreeting with HelloworldApiGreeting
Hope this saves time for others
I have recently updated a project that makes use of the Android Support Library ( android-support-v4.jar )
I updated the support library by "Android Tools > Add Support Library"
After doing this my project fails to build and the following imports that worked fine previously now error.
import android.support.v4.app.FragmentManager;
import android.support.v4.widget.SearchViewCompat;
import android.support.v4.widget.SearchViewCompat.OnQueryTextListenerCompat;
With errors long the lines of "The import android.support.v4.widget cannot be resolved"
What have I done wrong? how do I get it working again?
Which API are you using? It is best to use the Android SDK Manager in Eclipse(ADT) plugin to download the support libraries.
The Android Support v4 JAR needs to be in the 'libs' folder of your project. Make sure you have the JAR 'copied' in the folder. It is best to manually do it yourself to make sure it is there.
The best way to fix the 'red' import errors in Eclipse is
Ctrl + Shift + O
to automatically import the correct imports.
Please let me know if this helps! I have had problems with Android imports as well.
Regards,
The jar file also needs to be in your build path.
I'm trying to get the Android LVL (App Licensing) setup to work with my software... and I cannot get it to import into Eclipse at all. The documentation says, "add the library folder to your workspace"... but it won't let me. I have rev. 2 downloaded... but when I try to import the project (from /android-sdk-macosx/extras/google/play_licensing/library) it shows up greyed-out in the projects list and won't import. Can someone please help me out here?
Just drag the sources into your project. The intention of the LVL is that you build your own sources and make changes (to try to thwart people that modify your binary by looking for LVL-specific bits).
I'm struggling with getting the demo of the level 4 support library set up in Eclipse and running. Apologies in advance for the length; I want to completely describe what I have done. Would really appreciate the help of one of the experts here in SO.
Here is what I've done -
1 - Create New Project:
Rather than trying to let Eclipse "Create project from existing source" or "Create project from existing sample" and all the problems that seem to result from those project setup approaches I created a new project.
2 - 'src', 'res' sub-directories:
Deleted all files that were auto-created from these directories and then reproduced the folder structure and all files into the project from the sdk version of the Support4Demo.
3 - Added support jar
Created a sub-directory named 'lib' and added a COPY of the android-support-v4.jar to it. I then added this to the Build Path (this resulted in new folder named "Reference Libraries" with the android-support-v4.jar file in it.
4 - AndroidManifest.xml:
Replaced the auto-generated manifest with the one from the demo project directory.
Problem/Question
I get a warning from eclipse about the target API level in
Attribute minSdkVersion (4) is lower than the project target API level (13)
OK, I understand that one. (I want to be able to run this on a level 8 (or lower) virtual device. That's what this support library is for.)
But I also get an error in the manifest file that I can't make sense of -
error: No resource identifier found for attribute 'stopWithTask'
in package 'android' AndroidManifest.xml /Supportv4Demo line 226
Android AAPT Problem
The line in the manifest that this refers to is a Service reference -
<service android:name=".content.LocalServiceBroadcaster$LocalService"
android:stopWithTask="true" />
I'm not very experienced with Eclipse (and that's certainly part of my problem) but I suspect that Eclipse has tinkered with the includes somehow and that I'm not getting the proper package reference somewhere. I've inspected the class LocalServiceBroadcaster and it's 'includes' look like this -
package com.example.android.supportv4.content;
import com.example.android.supportv4.R;
import android.R.attr;
import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
... more includes
import android.support.v4.app.ServiceCompat;
import android.support.v4.content.LocalBroadcastManager;
... more includes
How do I get this demo of the support libraries setup and running?
Thanks in advance for any help you can provide!
As you can see in the docs, stopWithTask is only available in API level 14 and above. Either change your target SDK level to 14 or remove that attribute. (It's nothing to do with the includes).