Error while running Calendar project - android

I have downloaded calendar project from https://github.com/android/platform_packages_apps_calendar and now I'm trying to run that project. I imported the project to eclipse via new --> Android project from existing source, it imported successfully but I'm getting a red exclamation mark in project, like this:
When I went to properties > Android I'm seeing this:
It looks like the project is using some libraries but is not able to find in the workspace. How can I fix this?

You may to add the following dependencies as well.
https://android.googlesource.com/platform/frameworks/ex/
https://android.googlesource.com/platform/frameworks/opt/colorpicker/
https://android.googlesource.com/platform/frameworks/opt/calendar/
https://android.googlesource.com/platform/frameworks/opt/datetimepicker/
https://android.googlesource.com/platform/frameworks/opt/timezonepicker/

I was able to build the AOSP Android calendar.
Ye Lin Aung give you almost all the neccesary, but you will need also "chips" library. This library is not included in the last master aosp necessary packages , but its in their repository in the old versions.
You can find the neccesary libraries in the next repository:
https://gitlab.com/Purcallas/AOSPCalendarExtensions/tree/master
Or in the Google repository (as say Ye) you can find chips and common values:
https://android.googlesource.com/platform/frameworks/ex/+/ics-mr1

remove all the library from here and import each and every one in your project workspace and then after add the library.

Related

Using serial for android library

I'm trying to implement this https://github.com/mik3y/usb-serial-for-android/blob/master/UsbSerialExamples/src/com/hoho/android/usbserial/examples/SerialConsoleActivity.java in my project but there is something wrong with this sample.
Line 121:
sDriver.setParameters(115200, 8, UsbSerialDriver.STOPBITS_1, UsbSerialDriver.PARITY_NONE);
Why I can't see this method setParameters()?
I had the same problem when I tried to use the example project. The problem I had was that I was using usb-serial-for-android-v010.jar that you can download from the git repository. I think it was created using an older version of the project and doesn't support some of the newer features like setParameters. If you downloaded the example project there should be a folder inside called UsbSerialLibrary. Import that into your IDE and add it to your build path: (Eclipse) Properties>Java Build Path>Projects>Add. This should let you use setParameters.
Also, the API was recently refactored so you may want to look at that.

How do I import com.google.android.gms.* in Android Studio using a Gradle build?

I have followed the procedure as described here : Setup
I have clicked on the little 'Sync project with Gradle' button. Gradle and Android Studio seem to find everything but then I can't actually use the gms code. If I try to import, I will get autocomplete for com.google.android.gms but no further. I have updated all the packages with Android SDK Manager.
I'm running Android Studio 0.4.2.
My minSdk is set to 9
my build.gradle includes compile 'com.google.android.gms:play-services:4.0.30'
As far as the procedure is concerned I should be ready to code, but it just doesn't work. Any ideas?
[Edit, added info]
I can find the ComGoogleAndroiddGmsPlayServices3265.aar file in my exploded bundles directory. Inside of that file I also find the common directory and inside that I find the GooglePlayServicesUtil.class (which is what's not being found in my app)
I am lost.
[Edit 2]
The problem is not specific to Google Play Services OR Android Studio. I tried adding another library (HoloColorPicker) and had the same results. However, I was able to add the library's resources to my project! I was able to add them in my XML layouts and view them in my application. I was able to interact with them, they worked fine. The problem arose again when I tried to reference them in the code. Exactly like the case with gms, I had code completion when trying to import up to the point of the actual class, and I could not declare the class in the code.
I was able to use the library by cloning it and importing the project.
Also, this is not an Android Studio problem because the same thing happens on the command line with "./gradlew clean build"
This is a current bug in Android Studio: https://code.google.com/p/android/issues/detail?id=64508 to be fixed this week.
The workaround is to close the project, delete the .iml files and .idea project and re-import the project.
Keep Your compile 'com.google.android.gms:play-services:4.0.30' as very first line in build.gradle dependencies like
dependencies {
compile 'com.google.android.gms:play-services:4.0.30'
compile 'com.android.support:support-v4:18.0.+'
compile 'com.android.support:appcompat-v7:+'
}
`
Open File> Project Structure and do the following steps
Select your main module in which you want to add dependency and click on OK.
Now try to import.
I think the most important question is what you want to achieve. Not all code is under this package. Not even sure which one is.
As noted before, this is a bug with Android Studio. It just don't recognize the path for classes and shows you like if there is an error. If you try compiling you'll see that everything just work fine.
A googler recently said it'll be addressed in this week release, so, be patient and lets see whats coming.
The fact that AS is in Preview mode tell us this sort of things are going to happen :)
Android studio is crazy one, I think.
It's removed "Import module" function and you can do "New module" only.
If you are developed on Eclipse, you need export all your projects to Gradle before switch to Androids studio (WTF?)
I prefer "IntelliJ IDEA Community Edition", although It's similar Android studio but it's better than Android studio (at least until now). You just import your project as eclipse format, IntelliJ IDEA will detect dependences libraries automatic (May be you need import jar libraries by hand) and rebuild project. That Done.

SmartWatch sample installation

I would like to compile the sample provided by Sony for his SmartWatch. I followed the instructions in this page. But when I added the the SmartExtensionUtils project I saw lot of errors like: com.sonyericsson.extras.liveware.aef cannot be resolved to a variable. Instead this import com.sonyericsson.extras.liveware has no problem.
Did someone find and solve this issue?
In order for the EightPuzzleGame to compile, you need to add the following library projects that are available in the SDK:
SmartExtensionAPI
SmartExtensionUtils
SmartExtensionInternalUtils
In your case, it is the API project that is probably missing. You can see what library projects that are missing by checking the project properties. Example:
What you need to do is go to the properties page of the SmartExtensionUtils library and in the library box add SmartExtensionAPI as a dependency
This is a link to my desktop screenshot. SmartExtensionAPI and utils are in the project list (left side) but the EightPuzzleExtension does not find them
You don't need SmartExtensionInternalUtils project. When you create project from existing source, check Import project into Workspace. In this way EightPuzzle, SEAPI and SEUtils will be in the same directory and you'll not have no errors :)
I had this problem too. What i did is to solve it, is to import from the Sony samples in the Sony add-on SDK 3.0 the SmartExtensionAPI first and than SmartExtensionUtils. If these samples are build correctly the other samples will build correctly as well.
Go to File|Import, choose SmartExtensionAPI as your root directory and click finish. Maybe you have to change the compiler compliance level to build it correctly. After this do the same for SmartExtensionUtils.

ERROR: "._android-support-v4.jar" in project FacebookSDK

Help needed!!!! Stuck for 2 weeks on this and help needed.
I've recently imported the facebook sdk for android and its projects into my workspace. It shows up errors and the problems:
Archive for required library: '/home/Documents/facebook-android-sdk-3.0.2.b/facebook/libs/._android-support-v4.jar' in project 'FacebookSDK' cannot be read or is not a valid ZIP file
And the samples get errors along the line of:
The container 'Android Dependencies' references non existing library '/home/Documents/facebook-android-sdk-3.0.2.b/facebook/bin/facebooksdk.jar'
The things I have done following the other discussions without any success are
cleaned project
set the Facebook SDK as library
looked at the build path section and added external jar consisting of facebook/libs
imported fb sdk like 20 times and into different folders.
made sure my java compiler was 1.6
HELP would be very greatly appreciated!!!!
Take the lastest version of android-support-v4.jar (in your sdk environement : sdk/extras/android/support/v4/android-support-v4.jar) and replace in your project and library project do not create conflict.
The steps to importing a library are:
Download the library
Place the library in the libs folder of the project.
Build the project
Do Not attempt to import the library using some import wizard.
I suspect either your download was corrupted, and you need to do it again, or you put the file into the wrong directly.
I think your problem is that the android.support.v4 versions are different, take the one from your project and replace the one in the Facebook sdk lib folder, it should dismiss the clash.
As per your question, I think you are not able to compile once you add the SDK to your project. Do you get an error saying unable to run as library?
If so that means you have included this as library and create your project as a library to be used further. It is a common mistake that I have seen many people do when they try to import a library to use and tick mark the checkbox is Library. This actually means you want this project to be treated as a library for future use. Just try to add the SDK and do not tick mark the checkbox and this project will run fine.
Many forums will just tell you to tick that checkbox and you will be stuck on this error for long time.
For any .jar file related issues you have to make the .jars files compatible as there hashing a problem and the two jars are not compatible with each other (a version issue).

Can not include source library in project in Intellij IDEA

I've created library project in IDEA with common helpers, which I use in my android applications.
Then I've created android application and included in it my library project like this tutorial said.
Everything seemed okay, code autocomplete worked fine, IDEA recognize that library and all classes and methods in it.
But then I compiled application and saw error "'org.my.helperlibrary' does not exist". However as I said IDEA acts like everything okay before making/launching project.
Here is similar question, but answer is trivial, of course my library has checked "Is Library Project" option but I still can not launch my application which use my library.
Updated:
I've just saw an error: "UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Lorg/my/helperlibrary/Helper;" when I removed all usages of library in my android application. So it's just included in my app and not used.
It turned out that I should not add dependency manually in that window
I rather should add new module in my Project window at the left
Then I should choose iml file in the root folder of android library project I want to use
Then I pressed finish and from that point I had two modules in my project
After that when using classes I can press Alt+Enter on any class from SampleLibrary and tell IDEA to add module dependency
Then I could see that IDEA made all I need without me. I can now use SampleLibrary from SampleApplication!
Try to select library project, then click Build -> Compile <your library project name>.
Then back to you project which use this library and click Build -> Rebuild Project.
After that try to run project again.
Hope it helps.

Categories

Resources