I have a gradle flavor of my android app that uses the AdMarvel SDK. The app is trying to launch an activity using
com.myapp.flavour1/com.admarvel.android.ads.AdMarvelActivity, which results in an ActivityNotFoundException.
I believe that it needs to call com.myapp.main/com.admarvel.android.ads.AdMarvelActivity.
Is this something that can be fixed in a manifest / gradle config?
Is it caused by using the wrong context in my parameters?
Or is it just a bug in the library?
Any help would be appreciated.
Thanks.
You will have to create a separate manifest xml for the given flavor, and in that manifest, declare the activity from the AdMarvel library. There is a SO question about the latter part.
As for the flavor-specific manifest, you need to put in under src/flavor_name/res/AndroidManifest.xml - this is described here.
Related
I recently used the recyleview support library and I am seeing that it is creating a intermediate file of AndroidMainfest.xml with android.support.v7.widget.TestActivity in that. I don't want this activity to be created as it is giving error while running the app. I am using gradle 1.3.0 version.
Do any one know how can I remove it?
Use remove tool in androidMainfest for that activity and it will remove the activity from Mainfest.
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).
The docs state:
As mentioned previously, next to the main sourceSet is the androidTest sourceSet, located by default in src/androidTest/
....
The sourceSet should not contain an AndroidManifest.xml as it is automatically generated.
So, if I want to add extra permissions for the tests, what is the correct way to do it?
As of version 0.13.0 (released 2014/09/18) of the Android Gradle plugin it is now possible to have a custom manifest for Android tests.
It is now possible to provide a manifest for test apps (src/androidTest/AndroidManifest.xml)
Source: https://sites.google.com/a/android.com/tools/tech-docs/new-build-system
For more information see the sample "gradle_examples_0.14.4/tree/master/androidManifestInTest" - although it seems to me that there's no special configuration needed.
I have an application that supports different domains. My code is developed under the package: com.example. I would like to publish multiple application under different packages like:
com.example.domain1, com.example.domain2, etc.
In the manifest I define:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.domain1"
....
and for domain2:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.domain2"
The problem I am facing is that once I change the base package name from domain1 to domain2 I need to rename all my packages in the src folder as well as layouts. What I am looking for is to keep the same base packaging com.example and distribute the different apps under its sub-domains.
Is there a better way?
Clarification:
When changing the package name, the resources file changes from com.example.R to com.example.domain2.R. This means that I have to go into all src java classes and layouts etc. and update the generated R file location. That is not handy.
I ended up marking my main project as a library and then creating a project for each domain and linking to the library.
No need to play around with the manifest or the R.java file.
Thanks to #Tenfour04 for pointing me in the right direction!
In your manifest, each Activity, Service, Provider and Receiver has a name attribute. By default they use a shortcut like ".MainActivity" The leading . is a shortcut for the package name at the top level of the manifest.
So if you don't want to rename all those packages in the src folder, just type out explicit names for the Activities, Services, Providers, and Receivers in your manifest, for example, android:name="com.example.sharedmultiprojectdomainname.MainActivity".
If you are using Gradle as your build system, you might want to incorporate build variants into your build, which will solve package problems. More on this can be found in this Google I/O speech
Hope this helps.
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.