AIDL Service and Android Open Source - java

I've created an AIDL service called IHelloService and I am trying to call it from IOBridge under the libcore module.
Currently my code looks like this
// import
import android.os.IHelloService;
import android.os.ServiceManager;
....
IHelloService helloService = IHelloService.Stub.asInterface(ServiceManager.getService("hello"));
int val = helloService.getVal();
I run into errors when doing a standard build.
The errors include package android.os does not exist and cannot find symbol ServiceManager and IHelloService
I've already declared package android.os in the HelloService aidl file, so I don't think that's the issue.
Any help would be appreciated.

Sang,
Your issue is actually one I have been working through. What you need to do is build a new SDK for use with that specific service so that Android Studio (I am assuming that is what you are using) can recognize it as being available in your version of the ROM.
Here is what you should do: (found at https://android.googlesource.com/platform/sdk/+/master/docs/howto_build_SDK.txt)
Go to your Android build area and run . build/envsetup.sh
Run the command "make update-api" in your build area. This will update the files with the changes or additions you have made to the api.
Run "lunch sdk-eng" to set up the build for the sdk.
To make the SDK, run "make sdk". This could take some time (20m - 2hr), but will end with the line "Package SDK: out/host/darwin-x86/sdk/android-sdk_eng..zip"
Now that the SDK is made, you will need to point Android Studio to the new SDK. TO do this:
RIght click on your app, and select "Open Module Settings".
Choose "SDK" from the menu on the Left.
Select your new SDK path.
There might be other ways to do this, but that is the process I am working with currently.

Related

java.lang.noClassDefFoundError: Failed resolution of: Lcom/facebook/R$style;

I try to add the facebook sdk to my delphi android project. I add to the libraries the file facebook-android-sdk.jar, however when i run the app and try to launch for exemple :
package com.wrapper.facebook;
import com.facebook.share.widget.AppInviteDialog;
public class FaceBookAppInvite {
public static boolean canShow() {
return AppInviteDialog.canShow();
}
}
when i call from delphi canShow i receive the error: java.lang.noClassDefFoundError: Failed resolution of: Lcom/facebook/R$style;
what did i miss ? where to find and how to add R$style ?
Android development tools will generate [your package].R.java from your android project resources when you compile your project.
And then some resources would be parts of inner class of R class.
I think you know this well.
After looking your question, the Lcom/facebook/R$style may be the R class generate from facebook sdk resource.
but i have no any experience of using facebook sdk, however i have some sugestion for you:
1.Decompile the facebook-android-sdk.jar. Make sure that there is no any R class in it.
2.Read the facebook sdk tutorial again.Try to find out which stup you have miss.
3.What kind of ide do you use? may be your project output apk does not include any facebook sdk, because your ide compile script does not output sdk with your codes.so check it out.
4.Do you have more runtime log?

BaseGame Util cannot be resolved to a type

my project requires BaseGameUtil library
I have BaseGameUtil library downloaded form here
But when i import it in my android project it doesnt show baseGameUtil instead it shows main as added in my eclipse project and even when i add that main library i still get the same error.
Can anyone help me.
I think you may be using the version of BaseGameUtils in here:
...\android-samples-master\BasicSamples\libraries
But you are using Eclipse so you need to use the one in the following location:
...\android-samples-master\eclipse_compat\libraries
You may then also encounter an error with the GameHelper.java class in the BaseGameUtils folders. Use the code available here instead: https://gist.github.com/EmmanuelVinas/ef09a35bcc805ba6deb3
BaseGameActivity cannot be resolved to a type
public Class FisrstActivity extends BaseGameActivity{
In your project, right click > properties > Android > in Library section check if your library is correct and don´t show any red cross.
Check the same for your BaseGameUtils library, probably the reference to google_play_services is incorrect.
you problem must be similar to : android - import - with developers google com games
Basegameutils from github includes all source .java files in java folder. When implementing in eclipse, move all these folders from 'java' to 'src'. Eclipse compiles them to produce .class files which fixes this problem.

eclipse can not locate my foregroundcameraplugin.xml file

so im making this cordova / phonegap application.
I found out that The default Phonegap (Cordova) Camera Plugin calls the native camera and this makes Android Garbage Collector to kill background applications.
so I found a plugin that fixes this :
https://code.google.com/p/foreground-camera-plugin/
now I followed the steps as these guys told. and I'm having the following problems that I cant resolve and need help on.
There was a problem with the cameraActivity.java it did not recognize thegenerated file R.java
then I used an import statement to make it have access to this file
import statement : import java.android.R;
after this eclipse doesnt recognize the foregroundcameraplugin.xml.
besides this my my styles.xml files in values-v11 and values-v14 directories are giving an error
"Error retrieving parent for item; no reources found that match the given name #android: Theme.Holo.Light.DarkActionBar "
this is how my forground camera plugin looks like :
If anyone knows how too fix this please let me know
thank you
I was able to reply the error with the new Eclipse Kepler and found the solution: upgrade your ADT to version 22 and install Android SDK Build-tools by SDK manager. I have also commited a new classpath file for ForegroundCameraPlugin project with some changes (included Android Private Libraries). Thanks to your contact and the help of this link: Eclipse giving error, missing R.java file after recent update

R cannot be resolved to a variable eclipse android

I already tried all the answers present in this website. Deleted the "import android.R;" line. Even then every time I run my project it says "Your project contains errors, fix them before running your application". I'm working on Eclipse. As soon as I create a new android application project I am encountered with 2 errors which say “R cannot be resolved to a variable”. Here's my code for MainActivity.Java
package com.example.myfirstapp;
//import android.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentViewq(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
just try this at your imports
import your_packgae_name.R;
If you are getting same problem when creating new project then the problem is with your SDK Version.
Update your SDK to rev. 22.0.1
After updating you will find new tool in SDK manager that is android SDK build tools.
thn install that tool also.
Hope this will help you.
Right click on the project's folder and then, Android Tools --> Run Lint - check for commons error. When this don't work, disable automated build, clean projet, run lint again --> build.
Ah also, in the proprierties -> Android, verify that build target is checked...
Delete the imported android.R (As what you did)
Re-import R
Eclipse will allow you to choose which should be imported. Choose the R from your package.
I had the same problem.
The R.Java was not generated(in the gen folder).
There was no error in the xml file.
The issue was that I did not update the sdk completely.
In the SDK manager we need to install the package whenever the "install(number) packages" button is enabled
and close and open the sdk manager to check for updates.
Close and reopen eclipse and check for updates in eclipse also.
Make sure this line,
setContentView(R.layout.activity_main);
in your code it contains "q".
Then build your application and then run
One of your xml files might have errors. Hence, R is not generated. Fix them and R will be generated and the errors will be removed.
Check if file "R.java" exists in folder "gen"
When aapt can not compile the resources, the R class can not be created. Look for errors in the resources of your Application.
More output you can find in the ErrorLog and Console window
(Eclipse Window menu->show view->Console (and choose "Android" in Console popup menu)).
check your drawables and make sure there is no file with capital letters to avoid error!
.
Did you start the project a while back and recently it has done this when you went to work on it? I had the same issue and recently came to find an answer. It could be that the problem is you need to go into the SDK manager and install a particular update as per the answer to this question: Eclipse error: R cannot be resolved to a variable
Try this once
Go to Project
Check Mark "Build Automatically"
and Restart Eclipse
Okay so I had the same problem, and I also tried everything:
Check for bad naming, remove the import statement, installed the Android SDK Build-tools, check the AndroidManifest.xml, reinstall eclipse and android SDK etc.
nothing worked.
And I was even working with a completely blank project (new -> android project)
I then found out that the android SDK comes with an already zipped eclipse, so I thought I might as well try that one.
So I uninstalled eclipse 64bit, and used the one which comes with the android SDK (http://developer.android.com/sdk/index.html#win-bundle) and now I dont get the error anymore, so give it a try.
I also found that using eclipse 64bit with a java 32bit version might cause problems. So it might be that the one that comes with the Android SDK vertion is the 32bit eclipse.
Hope this helps.
The problem was caused by incompatibility of version. Here are the steps to fix the problem:
Right click the project properties.
Select Android
Select correct Project build target.
I fixed mine.
I found this way working Awesome. Which is also slightly similar to Mr.AndyFaizan,
Check any of your xml files have errors or not.if yes R might not generate.
2.Fix the error at XML files. Then R will be generated automatically
Then import the R which is suitable for your package.
YES, your error "R cannot be resolved" Gone!!
if this error occur immediately after create your project on eclipse. the main reason is manifest.xml error.
application icon path is wrong. copy ic_launcher.png into drawable folders.

JumpNote: main type is not specified

I'm doing my 1st steps in Android/GoogleApp, and I'm trying to explore the Jumpnote example:
http://code.google.com/p/jumpnote/
I was able to import the Android and Appengine projects to eclipse, but encountered the following issue when trying to run the Jumpnote-web part (android runs well).
When running the web part there is an error Main type is not specified which AFAIK implied that this project is missing a main function.
Is that indeed the case for jumpnote example and I need to manually add it, or am I missing something else?
Go to run Configuration
select JumpNoteWeb run configuration
You see in the main tab your project name and below it says main class
In the main class, put "com.google.gwt.dev.DevMode"
it should now run
*When I had this problem I also need to make sure that I put the src.shared folder into my project and had to change my build order so the app engine sdk, gwt sdk, and jre would build first

Categories