An Android Project Spinoff, standalone Android SDK - android

I don't use Android Studio nor Eclipse, but I just got into Android development.
I wrote an app, named project A here. It works just fine!
I wanted to write a similar app, so I copied the whole A project and made the B. I changed the name labels in the manifest, I changed the project name in build.xml, but when I install B it actually overwrites A!
What am I missing? How to install A and B, without removing one another?

The package name/application id (in the manifest manifest tag package=...) are still the same probably.
Example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bimjay.timerflow"
android:versionCode="100"
...

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.

Modified package of my project, but the change doesn't affect the application

I accidentally created a new project within a package like "companyname.applicationname". So I forgot the top level domain. It should be "de.company.application".
I managed to modify my project. I changed the package in my manifest, and also all paths and file locations which needed to be changed for the project to no longer give me errors.
So in Android Studio everything looks fine. But if I install the app on my phone, the package is still "company.application".
Have I missed any occurence of "company.application" in my app which need to be changed?
You must have forgot to change applicationId in your build.gradle

Eclipses does not seem to generate the correct Blank Activity android project

Hey guys I am new to Android development with eclipse. I am following the walkthrough on the google website (here) and already hit an issue with it. I've installed the SDK and eclipse as instructed. Now I am trying to create and run a default Blank Activity android app. When I create the project, eclipse creates an appcompat_v7 project along side my MyFirstApp project. When I hit run, the app seems to be build without any issues and the log tells mw that it is installed on my app. But nothing happens, and I can't find it on the device.
Now the reason I think that it is not getting generated is because that Android Manifest is very barebones and missing lots of vital things by the looks of it:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
</application>
Secondly, the next step in the tutorial asks me to open up the fragment_main.xml file from the res/layout/ directory. This file does not exist. The directory is empty, there is nothing there.
I don't get any errors so I am not sure what has gone wrong.
So after a long discussion with #Prodigga, we came to the point where we think it is better to take a step back and wait for things to settle with the new SDK release (api level 21).
By the way, tutorial in the question is not outdated. There is this minor problem with the new sdk.
I don't know what is causing the problem and I don't know the solution yet but there is a workaround. If you only want to create a blank activity, given that you are experiencing the same issue, do as follows
Uncheck "create activity" check box when configuring your new project.
Create the package and MainActivity manually.
Add it to the manifest manually.
If you would like to benefit from code auto-generation, then I recommend downgrading the sdk. For example, you could use this ADT bundle (10/30/2013 - Windows 64-bit), but don't try updating the SDK to level 21, not yet.
In your android manifest file, add an activity element as the child of the application element. Add the name of the Activity class that you would want to show on the launch screen. See the below link on the syntax for this:
http://www.mkyong.com/android/how-to-set-default-activity-for-android-application/

IntelliJ IDEA - Can't build anything, always get "package R does not exist"

I'm trying to use IntelliJ IDEA to work on an Android app with a colleague that swears by it, but I'm unable to build any of the Android projects he sends me because whenever I try a build I get an error saying package R does not exist.
I have been trying out everything I can think of. Examples and other things to note are:
Making sure I have a version of the local.properties file pointing to the root of my Android SDKs folder.
Fiddling with various settings in the project structure dialog (I won't list them all).
The project I'm working on has two library projects with also use the R class and they work fine.
The intellisense within the IDE recognises the R class and comes up with the stuff I expect.
Any help would be greatly appreciated. I feel I'm missing something basic.
I am brand new to IntelliJ so I apologize if this doesn't work for you. I was experiencing the same problem and the solution was to add an Android Facet to your project.
(I am on a Mac, so directions here may be slightly off, and there are probably better ways to find this window, if so let me know!)
Right click your project and go down to Open Module Settings (seems F4 also works)
Select Facets in the far left column
Click the + button
Add an Android Facet to your project, and VOILA!
You may need to import your Rs now, which could be a huge pain... so hopefully someone can chime in with an easy way to auto-import
Hope this helps someone!
Another possible solution to those listed here is to check that the package name in your AndroidManifest.xml matches that of your actual package:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.yourpackagename" >
My package was building fine until I refactored the package name, everything refactored except for the package name in manifest file (see above) which caused the error "Package R does not exist".
If you run into this with a package that has been building before you need to "Rebuild".
Build->Rebuild Project . Deleting gen does not do it since IDEA saves the actual generated R somewhere else.
In my case, I added some classes from another project and I had to add the import to the R package from my actual project:
import com.youcompanyname.yourprojectname.R;
I've started playing around with IntelliJ since I've had issues with the new Android Studio and wanted to try something that was a little more stable (I've never really used either before). I ended up getting the dreaded “package R does not exist” error. In my experience, this is usually something messed up in an XML file. For me, the problem was actually with the AndroidManifest.xml file for an Android Library Module that I had created for ActionBarSherlock. For whatever reason, when it created the AndroidManifest.xml file it didn't bother to use the AndroidManifest.xml file that came with ABS and it put the following in:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ActionBarSherlockLibrary_4_3_1"
android:versionCode="1"
android:versionName="1.0">
<application
android:label="#string/app_name"
android:icon="#drawable/ic_launcher">
<activity
android:name="ACTIVITY_ENTRY_NAME"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
When I created this Module I chose File > New Module...
I then Selected Library Module under the Android section and for the Content Root I browsed to the location of the files for ABS (Other fields auto filled in correctly and I didn't change them).
I then clicked finish and it prompted me if I wanted to keep the local file or the memory file for project.properties.
I chose to keep the local file and it didn't prompt me for any others after that.
I have no idea why it messed up the AndroidManifest.xml file (maybe what I did above was wrong...???), but to fix it I just copied the original AndroidManifest.xml that I had downloaded with the library and replaced the messed up AndroidManifest.xml file. After that I did Build > Rebuild Project and it resolved the “package R does not exist” errors.
One other thought, #xbakesx mentions the Facets settings, and for any modules you are using as libraries, you should make sure that "Library module" is checked under Facets for that Module. I had some issues with that at first when I was trying to figure out how to configure libraries in IntelliJ/Android Studio (I've really only used Eclipse).
I just restart IntelliJ and it magically solved.
Try it first.
Had same issue - the issue was the Manifest file was did not have the default Activity setup properly.
To all the hopeless people who have reached this far down the answers: I feel your pain. I have spent an hour doing nothing but trying all those things above as well as proposals from other sources. I have checked all my xml resources twice, cleaned caches, rebuilt a dozen times, even restarted the entire machine. Here is what actually worked for me:
Under 'Build Variants' (lower left corner), I selected a different Build Variant (in my case release instead of debug) for the target that had the missing R problem. Solved it.
I've refactored the packagename and intellij didn't update it in the manifest.
So if you've refactored the packagename then go to the manifest and update the attribute "package" in the root of the xml file save and rebuild it. If any errors occur then it's probably a wrong packagename in the import (at least this was my case) so just fix them
hope this helps anyone
In my case I had to delete the intellj compiler cache. on my windows machine it was somelike this:
%USERPROFILE%\.IdeaIC12\system\compile-server\<my project>
Try create new project and select "Create project from existing sources"
Adding my $0.02 just in case someone else has the issue I did. In my case I had generated the "Hello world" application using IntelliJ and forgot to change the package name from "com.example." I then used IntelliJ to refactor the package name. This caused the error to start happening.
So I did a global search for "com.example" and it was found in the AndroidManifest file as mentioned by others. However, changing this did not fix the problem. "com.example" was also found in "workspace.xml" under the ".idea" directory. I changed all the occurrences their, did a rebuild and then it started working again!
This seems like a bug in IntelliJ.
In Android Studio, my problem was when i copy pasted a class to use as a template to make another similar class, it asks to automatically import a bunch of stuff, most of which was not going to be related to the new class, so i said cancel. with it it left out import com.your.packagename.R; so R wasnt actually being imported into the file i was trying to use it in.
can be fixed with an alt-enter when clicking on R (it should be highlighted in red)

app installations overwriting each other

I have developed two android apps...when i install them on my phone to test them.. they overwrite each other. I do not want this to happen. The intent is to have both installed on the phone as separate apps.. how do i fix this? I developed them with eclipse.
I had the same problem despite the fact that package names were different between both APKs.
At the end I had to modify a GRADLE file:
\app\build.gradle
the following line:
applicationId "name.to.change"
In Android Studio 3 you will find this configuration in:
I had the same issue, turned out that I had copied one project to another to save time, and the package setting in the Manifest tag inside the AndroidManifest.xml file was the same for both apps.
Once I changed this and resolved any imports errors, the apps stopped overwriting one another on the phone.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxx.yyy"
android:versionCode="1"
android:versionName="1.0" >
Do the apps share the same namespace? Verify that they have their own packages in Eclipse.
also share the same user id, modify it in the manifest.

Categories

Resources