0

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.

SteveEdson
  • 2,485
  • 2
  • 28
  • 46
  • Can you show your declaration in the manifest? – Kevin Coppock Sep 24 '14 at 18:19
  • 1
    I've fixed it. In my flavors manifest, I forgot to wrap the tags within the tag. The manifests were being merged correctly, however the activity was in the wrong place and therefore could not be found. Stupid mistake! Thanks anyway – SteveEdson Sep 25 '14 at 11:55

1 Answers1

0

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.

Community
  • 1
  • 1
sfThomas
  • 1,895
  • 2
  • 18
  • 26
  • Are you sure about `src/flavor_name/res/AndroidManifest.xml`? I've also read it in the docs, but moving it to just `src/flavor_name/AndroidManifest.xml` makes it appear in Android studio as a flavor manifest, but it seems to merge it in anyway. I declared the activities in the flavors manifest, but it didn't work. I've since moved it to be declared in my main manifest, which works. However, this seems wrong as its only the one flavor that will actually have the activity. – SteveEdson Sep 24 '14 at 18:13
  • I am doing almost the same in my project, except that I am customizing a different file - and it seems to work very well. You also need to select the variant you want to build in Android Studio on the Build Variants tab. Also, not sure what you mean by 'moving' - you need two files I think, one 'default' in src/main/..., and one custom for your flavor. – sfThomas Sep 24 '14 at 18:16
  • I mean if I move the flavors manifest out of the `res` folder, directly into the flavor folder, it gets detected in the `Android` project view (by changing the Project dropdown to 'Android'). However, when this manifest is in the `res` folder, it gets ignored. – SteveEdson Sep 24 '14 at 18:20
  • Try building the project, and see what ends up in the APK - Android Studio is not always 100% correct in what it shows. – sfThomas Sep 24 '14 at 18:23
  • Yeah, at least I have it working now, I'll move the configs around and compare the generated manifests in the `build/intermediates/manifests` folder. Cheers – SteveEdson Sep 24 '14 at 18:30
  • I've fixed it. In my flavors manifest, I forgot to wrap the `` tags within the `` tag. The manifests were being merged correctly, however the activity was in the wrong place and therefore could not be found. Stupid mistake! Thanks anyway – SteveEdson Sep 25 '14 at 11:49
  • In this case I need to create an AndroidManifest to my flavor just like the other one? – Eduardo Bonfa Nov 01 '16 at 12:39