1

I have Android library, which contains several activities. The library is compiled as aar. When the library is used in one of my test apps or in the most part of client apps, everything works fine, but some clients complain, that they get ActivityNotFoundException, when one of activities from the library tries to start.

android.content.ActivityNotFoundException: Unable to find explicit activity class {<full activity name>}; have you declared this activity in your AndroidManifest.xml?

My package name is not like “com.example…”, that’s why I don’t think , that there is Activity with the same full name in client app. One of the clients was able to reproduce this problem on device and on emulator, so the problem doesn’t look to be related with concrete device.
I use Android Studio 2.2.3, Gradle plugin 2.14.1, Android plugin 2.1.3.

Denis
  • 147
  • 4
  • may i know about your activity name is it in library class or your class ? – Milind Vyas Feb 01 '17 at 05:11
  • 1
    Even if the activities are part of your lib. It should be part of your manifest file. Make sure you have mentioned all those activities with their proper path in manifest file. – Hardik Trivedi Feb 01 '17 at 05:12
  • @MilindVyas, my library contains activity class, it is declared in library manifest. – Denis Feb 01 '17 at 05:32
  • @HardikTrivedi, yes, my activity is declared in library manifest. If it would not be declared there, it will never open in any app. But it works fine in all my test apps and in most part of client apps. – Denis Feb 01 '17 at 05:36
  • do the user need to declare the same activity name at their manifest file while using your library? – Ankush Bist Feb 01 '17 at 06:09
  • @AnkushBist, no, Gradle does it automatically. I have decoded apk of my test app by [Apktool](https://ibotpeaches.github.io/Apktool/) and decoded AndroidManifest.xml contains declaration of my library's activity. As I know, it was necessary to declare library's activity in app's manifest in Eclipse. – Denis Feb 01 '17 at 06:16
  • that's the issue. Ask your clients who is having this issue. They might not be declaring the same at manifest. – Ankush Bist Feb 01 '17 at 06:24
  • @AnkushBist, that's the issue only if client uses Eclipse for developping his app, but the only official way of installing my library is Gradle way. At least one of clients, who faced the problem, uses Gradle build system. – Denis Feb 01 '17 at 11:22
  • then you should try this yourself in eclipse and you will get to resolve this issue. – Ankush Bist Feb 01 '17 at 11:24
  • @AnkushBist is there any condition that can prevent normal auto-merging of library manifest into final one? It seems that is what happening. – Dmitry Fink Feb 02 '17 at 02:48
  • @DmitryFink no idea about this and its been a long time that i have worked on eclipse. – Ankush Bist Feb 02 '17 at 04:09
  • @AnkushBist not eclipse, gradle, you musunderstood, it happens with gradle. – Dmitry Fink Feb 02 '17 at 05:25
  • @AnkushBist, no, Gradle does it automatically. I have decoded apk of my test app by Apktool and decoded AndroidManifest.xml contains declaration of my library's activity. As I know, it was necessary to declare library's activity in app's manifest in Eclipse...this was commented by you. – Ankush Bist Feb 02 '17 at 05:43

0 Answers0