Reputation: 10755
I have two android application and here are the packages in which they are located.
com.android.app.sample1
com.android.app.sample2
as you know every application have it's own res folder and if I want to get some string for sample1 I must write com.android.app/sample1.R.string.some_string
and if for sample2 com.android.app/sample2.R.string.some_string
Now if I have some other project with package
com.android.app.testingsamples
and my sample1\src
and sample2\src
are linked as a resources to the testingsamples, but when I link src
to the testingsamples an errors like "cant find resource R" appears.
I try to change my all applications package to the same com.android.app
in that case when I link applications as a resource to testingsamples everything is okay as R
is same and located for all in com.android.app.R
but this is not an issue as when I try to install sample1 and sample2 separately the install one above one as they have same package name.
Is there any Idea how I can do that for all projects R will be located in the same place ?
Upvotes: 0
Views: 238
Reputation: 27445
There is a difference between the package name within you src folder and the one defined in the app's Manifest.xml. Normally when you create a new project in Eclipse they are equal, but they don't have to.
All your projects can use the same package structure in their src folders. But to show Android that the both apps sample1 and sample2 are different apps, their package names in the the manifest files have to be different.
UPDATE
Sorry I realized this doesn't solve the problem as the R class is generated under the package name defined in den manifest.
Upvotes: 1
Reputation: 222
and my sample1\src and sample2\src are linked as a resources to the testingsamples, but when I link src to the testingsamples an errors like "cant find resource R" appears.
it's because the java file that is generated for R is in sampleX\bin. You might try to add these to your path to solve your problem.
If sample1 and sample 2 aren't separate apps, an even better way would be to make sample1 and sample2 android library and link them to your testingsamples. Thus both sample1 and sample2 R's are fused into testingsamples'.
Upvotes: 0