Android Settings project - android

I am trying to setup an android Settings project on eclipse. I got it from the tablet manufaturer. So I need to setup that project on eclipse and need to make some changes to the settings. When I get this project into eclipse then i am getting some compilation errors as follows:
code is looking for this class android.os.SystemProperties,R.xml.accessibilitySettings
Please let me know how to compile this project properly.
Thanks

If you get errors like this, press Ctrl+ Shift + O in order to update the packages automatically.
Sometimes, you might have to add strings in res directory, in separate xml file called strings.xml
Try running simple examples from android samples package for better understanding

Related

install more then one apps in one apk or make two project one?

i making an application ,there is an other app that i want to add to my project, it is a source code and i allow to edit and add to the app menu of my app , but i get too many errors and its not fixable.
remember: i don't want to create an other manifest.XML or add another icon to menu if i could fix the errors i would added them to app menu because its working in its own project, i want a new app install with my app.
1. is there a way that the installer install more then one app? it would hep a lot
if not perhaps you can help me fix it this way:
error:
i add the package(java files) of the app and i have access to its file, all the XML are added and if there is an error i tried to fix them, i didn't run the project because i was shore i get errors , i fixed all that i could but now i get an error like this:
now i think i have to import its R class but then , all of values are in the XML and there is no need to bring the R class:
its own R class with suggestion of android studio:
import com.softwaredownload.app.R and R is red when i run it:
Error:(75, 25) error: package R does not exist.
ops! why do i get error for my own package Java files ?! i also clean and rebuild and restart the android studio. i mean when i added them at the first place and i fixed the errors at the top of them was the green mark that there is no error.
also , all of the project files are added the proper way but they are not working like the source code, i mean all the XML files are edited and fixed.
No, you can't install another app in tandem with your own app
Remove all the.old.package.R-import statements from the top of your pasted classes
Rebuild/run the project
Android Studio will then suggest importing your own package's R.class. Accept this recommendation. This requires that you've copied all resources (not just the layouts) from the old app into your new app.
i fixed the error like this:
it is impossible for two app to add to one installer APK but i just edit them both and i added them to the project than i edited manifest.XML and add two icon to android menu.
2.there is no need to bring the R class , it was an android studio error that fixed.

Eclipse error : Your project contains error(s) , please them before running your application in android

When i run my project , I get " Your project contains error(s) , please them before running your application" this error . I searched this error on Google , There i got a lot of solutions all these did not work for me . I cleaned and Build my project , Restart my eclipse , in .android deleted debug.keystore and clean and build my project , But did not work for me . Please help me .
Thanks in Advance
Follow My steps :
There are many possiblity of this type of error try by one of the following .
Step 1 Right Click on your app then check library and order and export tab there may
be any error remove that according to your project .
Step 2 Right Click on your app then go to java compiler and made change of
compiler level
Step 3 If you have added any library project check that also
It works for me hope it will work for you also .
In my case, all the solutions you generally come across in the Net turned out inappropriate.
What I have recently found is that if you wanted to import a given Android project,
and you used General/Existing Projects into Workspace or Archive File,
you may probably face the issue above when there is no problem in the source itself.
What I did was using [Existing Android Code Into Workspace] instead of the above.
With this authentic way of importing Android project, such an error did not come about.
//
Of course, this applies when you properly added some necessary libraries and you have
no issue with your source codes.

Creating a JUnit test for Android inside of Eclipse using the suggested directory structure

If you read:
http://developer.android.com/tools/testing/testing_android.html#TestProjectPaths
It will tell you to create your tests inside your project at the same level as src. What it doesn't tell you is how to do it.
I checked out a post on here about this (http://stackoverflow.com/questions/5395216/creating-an-android-junit-test-project-in-eclipse) and found that it no longer seems to work on newer versions of Eclipse (Indigo for example).
So, how can you set up the project as they suggest so that the test directory is inside of the original project?
Note that if you do as the link suggests and uncheck the use default location, then Eclipse will prevent you from going forward as it gripes that you overlap the location of an existing project. If you try to add a sub-directory manually to place your project, then you can go on but you will get an error later saying "An internal error occurred while refreshing workspace" and no test project gets created.
Surely there is a way to do this isn't there or should I just disregard the suggested package structure and go with what Eclipse seems to want to do?

How do I force eclipse to update the apk on my hardware device with each build?

If I change some code, save, and Run, it runs the last version of the program, not what I just saved. The only way I can make it update is if I Clean the project, Build the project, and then Run the project. Is there some way to avoid this tedium?
I spent some time create two dummy projects (one Android and one Java) and have a play with it, and finally come up with a workaround which is not used very often but able to solve your requirements.
First, I will explain your question a bit more (based on my understanding and what I have tried) so that other people can have a more clear understand about what is happened here.
According to the conversation in comments:
could you tell me what you have in following setting: project->properties->Builder ? – Sudar Nimalan
#SudarNimalan: I am not sure this is what you are asking, but: there's text that says "Configure the builders for this project", and under it is a single option, "Java builder", which is selected (checked). – shino
for android project, there should be, "Android Resource Manager", "Android Pre Compiler", "Java Builder", "Android Package Builder" in this order, chould you add those and try? – Sudar Nimalan
#SudarNimalan: I owe you an apology; I do have those four components. My "project" is split into 4 projects - "core", "core-android", "core-desktop", and "core-html". It's a little weird because I set it up with the libGDX project setup UI, and I was looking at the 'core' project when I answered your question. My 'core-android' project has all four (in that order), and it is the one that has the problem in my question. – shino
Scenario:
You have 4 project:
core: a regular java project (common pure java code here)
core-android: an Android application project.
core-desktop: not related to question so ignored.
core-html: not related to question so ignored.
The core-android project has dependency on core project, by adding core to core-android's build path (Properties -> Java Build Path -> Projects -> Add ...) and export list (Properties -> Java Build Path -> Order and Export).
Problem (Not Really):
Change some code in core and save it, run core-android, eclipse install last compiled apk, not the new one with change.
Reason:
The is the expected behavior, the way you used to reference core project in core-android only create a weak link (or something sort of) between core and core-android, the core-andorid's auto-build script doesn't aware any changes made in core. You have to clean the project (only need clean core-android project) so that Eclipse can delete the existing apk (under bin directory) and re-generate the apk (with the latest code changes from core).
See Xav's comments below, Android SDK tools should aware changes from plain Java project under project build path, and it does not behaviour this feature normally at the moment.
Note that if core is an Android Library project, then there is no problem and your core-android project will aware any changes in core project (java code, android resource and etc), if core is only used in core-android, this could also be a workaround: turn Java project core into Android library project.
Workaround (Eclipse Link Source):
There is another way (not commonly used) for adding soft link between projects:
First, you need remove core project from core-android's build path, this will also remove it from Export and Order list.
Right click core-android, choose Build Path -> Link Source ... Add ../core/src as Linked Folder Location and src-lib1 as Folder Name,see screen screen in the end.
This create a symbolic link src-lib1 under core-android in Package Explorer windows point to core's src foder, in the file system, you still have two separate project folder. Now if you change some code in core and run core-android, Eclipse will build and install latest apk. No need to clean core-android project.
Link Source Window:
Final look in Package Explorer:
You should always consider the normal approach as first option, after all, manual clean project is not a big deal compare to the unusual approach I described above.
Please follow this steps..
1. Project--> Build Automatically been checked??
2. Please following setting: project->properties->Builder like that?
Check below image.
And Also Check Below Settings.
Also Check Below Image
IF problem continues then please Update your ADT & SDK.
Hope it works for you .
Navigate to Windows->Preferences->Android->Build. Make sure that the checkbox "Skip packaging and dexing..." is NOT checked.
The Problem is the In your Eclipse, go to Project Properties - Builder, There is one CheckBox with AndroidPackageBuilder that is required to be Checked True. Now everytime you will do any changes in you project that will be reflected in your build and the Compiler will never say that
"Application Already Deployed, No need to Reinstall"
This will work evenif you dont have selected Build Automatically, Because everytime you run by clicking Run icon or Ctrl+F11 that will first Build the Project and Then Run it. So The requirement is just to Enable the Android Package Builder
You won't believe how easy and silly is the solution
On Eclipse,
go to Window-Prefences->run/debug ->launching
And then, on Save required dirty editors before launching :
choose the Prompt option,
Apply and OK

Eclipse opens wrong source file on exception

I have several Android projects in an Eclipse workspace:
a stand-alone application project with a class my.package.Foo
a library project with a different class my.package.Foo
two application projects that depend on the library project and contain no source code
The problem comes when working with one of the applications built on top of the library project. When it crashes (sadly, a frequent occurrence), I double-click on a line of the stack trace in the logcat to go to the relevant source. The problem is, if the line is for Foo.java, Eclipse always opens the source from the stand-alone project. The only way I can direct Eclipse to the right source is to close the stand-alone project, which is somewhat inconvenient.
Is there any way to get Eclipse to pay attention to which application actually crashed when it looks for the relevant source file? I assume that this is some sort of classpath problem (similar to that described in this post). However, I don't see anything in the Android run configuration properties for modifying the class path. Eclipse always seems to run through the workspace projects in alphabetical order by name and opens the first my/package/Foo.java it finds.
I'm using the latest Android ADT and SDK versions.
Per the link provided in the comment by #blessenm, this is an issue with logcat in Eclipse. We should see a fix in Release 20 of the SDK tools. As can be seen here, the patch that fixes it has been completed and is in line for final approval.
Meanwhile, the best thing to do is to change the logcat preferences (Window -> Preferences -> Android -> LogCat) so that the double-click action is "Go to Problem (method declaration)" instead of the default "Go to Problem (error line)". This isn't foolproof: it will at least open the file but if there are multiple methods with the same name, it will go to the first method, regardless of signature. (When the fix is incorporated, there will be no need for options for double-click action and it should disappear from the preferences.)

Categories

Resources