Need to embed one android project into another android project - android

I have two android projects with me. I need to add the first project as a library to the other project.
Now, when I am trying to open the activity of library project from the other application on a button click, i am getting Android.content.ActivityNotFoundException at run time.
Can anyone suggest some pointer on this.

you need to check that you added the new activity to the manifest.xml file
if you are Using ADT(Android Developer Tool).

Thanks for the concern. This issue is resolved for me. Sorry for the late reply. I have created the second application as library project, which is included in first android project.
The point, which fixed the issue is: add the contents of the manifest.xml of library project in main project and the reference provided is the full path for the activity(including package name).

Related

Error in MainAcitivity.java file & no style are loading

I am new to android. I am creating an android application, but there are many errors showing in MainActivity.java. Here is a screenshot
Another problem is that no style in showing in activity_main.xml. Here is the screenshot
Although I have added appcompact_v7 jar file like this
But it's not recognizing it in android option of project propertise
I have installed Support library in SDK manager. Please tell me how to solve this problem?
It is really hard to say what is wrong there. here are some things that you should try:
first of all, there are errors in your xml file (activity_xml). Please check if xml is properly formatted and you are using right tags. For debugging purpose, please make your acitivity_xml an empty FrameLayout and see if it works.
Include android 6.0 into your build path. Clean the project and try building again. Make sure your layouts are error free before doing that.
Your eclipse is unable to detect referenced library at given location. Please make sure referenced library is at same place and ERROR-FREE. If library has error, your project won't include it.
Please solve all problems one by one. First make an error free xml, then a Hello world Activity. Run it on device or emulator. Once done, try to solve library and import problem now.
Best Suggestion: Please migrate to Android Studio and gradle for better support and learning.

Adding google maps library to existing project creates confusing error

I am building an Android app that I want to open google maps with the click of a button. I want the app to find the current location of the user and give them directions to a predefined address. I started building the application before I realized there were special steps that you have to take to include this functionality. To add this feature to my project I followed the directions on these two sites:
https://developer.android.com/google/play-services/setup.html
https://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
The problem is on the second site, when i added the library to my already existing project it caused all of my code that has findViewById(R.id.whatever) or setContentView(R.layout.whatever) to become errors. It is now telling me that i need to import the class R. If I do that it then gives me error messages on the names of all my xml files.
For example in my MainActivity it is telling me that i should change setContentView(R.layout.activity_main) to setContentView(R.layout.activity_list_item) and does this for all references to my xml files for the entire project.
I tried going back and removing the google play services library from the project and starting over but when I removed it the errors still persists. I also tried using the "fix project setup" option in Eclipse but it didn't fix the problem.
I'm wondering if anyone here has experienced this problem before? If so, how can I fix it? The application had no errors before I tried to include the google play services library. I am new to Android development so a lot of the information I have found has been either confusing to understand or doesn't seem to include enough details for me to figure it out. Thanks for your help!
Look at your imports, and check if you are importing the correct R.java from your application package, not from the android package.
Check also if your XMLs don't contain errors, otherwise R.java won't be generated.
In my case android-maps-library had to errors in two files (I have forgotten their names), I edited the two files removing errors my self. And finally I was able to used it quite nice.
i think you have correct yout Project build target, and this how:
right click on your project folder in the package explorer->propreties->Android
then porject build target and choose you Android target (Android x.xx)
but before that you need to remove import android.R;

how to use JakeWharton-Android-ViewPagerIndicator in intellij?

Hi there I am just newer in android development and I am trying to build my first app and I do will until now.
but I need to use ViewPagerIndicator so I do my search and I've found JakeWharton-Android-ViewPagerIndicator also I am using inellij IDE
but the problem that when I want to add this library into my project I can't find the jar file and I don't know if the error from my side or what please any help.
regards
You will need to create a new module with the library sources and add it as a dependency to your main module. This answer has detailed steps you can follow. Just replace the library used with ViewPagerIndicator.

How can I create test for Activity which is located in the library

The task is very simple but I can't find any solution.
I have an application which is based on my Android Library Project.
Activities are not defined in my main app but in the library project.
Eclipse doesn't allow me reference my library project from the test project targeted to main app.
Is there a working example to see how it is done?
If you want to use activity from Library Project, and you already attached it as library to build path, than you need also to put targeted activity in android manifest.
<activity android:name="com.packageInWhichActivityIs.activityName"></activity>
I`m assuming that you are getting class not found exception. Next time please provide more specific information.

Unable to reference a Library project - Android

Well, I wanted to create a Library project from my existing sources so that it would help me re-use code for the paid app that I have in mind. When I saw the developer guide on how this was to be done, I thought it was very simple.
Just mark the project as a Library project and it should be converted to one.
But when I tried referencing one of the base classes in an application, the app force closes with the following exceptions
02-04 21:50:06.765: E/AndroidRuntime(699): java.lang.NoClassDefFoundError: in.my.package.name.R$layout
Let me give you some more info. I have referenced the Library project in the application and have also included the manifest entries with fully qualified activity names. I have a BaseActivity which has all the menu and re-usable code bits. The point where the above exception occurs is where I am trying to reference the layout file in this BaseActivity inside the library project.
setContentView(R.layout.apphome);
What is it that I am missing or doing wrongly?
PS: I am just noticing that When I right click on my application and go to the android tab, there is a red cross instead of a green tick in the place where the library project is referenced. But there are no visible errors on the console or in the code of the project.
Seems its a known issue.
Issue link here
Hope Google guys resolve this problem in their next SDK release.
So to be clear, the problem was that my libraries had custom styling capabilities and that was the problem.

Categories

Resources