0

I am trying to use the Uber usebutton but each time, it crashes giving the following error:

Unable to find explicit activity class {com.heyjude.heyjudeapp/com.usebutton.sdk.internal.GroupedInventoryCardActivity}; have you declared this activity in your AndroidManifest.xml?

I am unsure what to put in the AndroidManifest, currently as per the docs I have:

<meta-data
            android:name="com.usebutton.applicationid"
            android:value="app-myId" />

But it's clearly not working...

I have some more information, I checked the manifest-merger-debug-report.txt and found the following line

REJECTED from [com.usebutton:android-sdk:5.0.1] /Users/adamkatz/Projects/LavaLamp/Hey Jude/heyjudestudio/app/build/intermediates/exploded-aar/com.usebutton/android-sdk/5.0.1/AndroidManifest.xml:13:5-43:19

Why would the library manifest be rejected and how to make it accepted?

Adam Katz
  • 6,999
  • 11
  • 42
  • 74
  • Have you declared your activity in your manifest ? ie. Do you have an `` tag inside your `` tag in your AndroidManifest.xml ?? – Jaswanth Manigundan Jul 25 '16 at 06:21
  • no i dont but what would I put inside of it? – Adam Katz Jul 25 '16 at 08:11
  • http://stackoverflow.com/q/19122386/1852441 Have a look at this. In short, what ever Activity you have used in your code, you should declare them in your android manifest. – Jaswanth Manigundan Jul 25 '16 at 23:36
  • i have included the activity the code is in, in the manifest – Adam Katz Jul 26 '16 at 08:00
  • You can find a [sample integration of this lib](https://github.com/button/button-android-samples) which has declared its MainActivity on the [Manifest](https://github.com/button/button-android-samples/blob/master/SampleIntegration/src/main/AndroidManifest.xml). As Jaswanth said, every Activity should be declared in Manifest within `` and make sure, you also declared your own application class in `android:name=".NameOfApplicationClass"` attribute. – Blo Jul 26 '16 at 14:01
  • my main activity is declared in the manifest.xml, I am working on an app that is already live and working, I am just trying to add the button to one of the existing pages – Adam Katz Jul 26 '16 at 14:13
  • As the logcat said, it's a Manifest declaration problem. Make sure your Activity owns your package name. Something is weird in the log, there are two different packages: yours (`com.heyjude.heyjudeapp`) and the lib's one (`com.usebutton.sdk.internal`). Usually, this should be presented as *{com.heyjude.heyjudeapp/com.heyjude.heyjudeapp.NameActivity}; have you declared...* – Blo Jul 26 '16 at 15:57
  • We probably need to see your Mainifest ;O) – Jon Goodwin Jul 30 '16 at 20:23
  • Adding a button? so your just reffering to a library class object in your layout ? show the layout. You will need to link the package library (for the button) in your java path. – Jon Goodwin Jul 30 '16 at 20:31
  • You cannot refferance an Activity in a layout, you say "I am just trying to add the button" so add an Android generic button. What that button DOES is up to you. VERY confusing, you need to give more detail. – Jon Goodwin Jul 30 '16 at 21:47

2 Answers2

0

The maifest stuff maybe a red herring, your probably missing a library (The Uber library). Here's a typical (working) AndroidMainfest.xml.

VERY important:
package="com.example.html2pdf" replace with your package name (it's normally in your (local package) GroupedInventoryCardActivity.java file).

VERY important: Html2pdfActivity" replace with one entry for activity for all your Activity files .GroupedInventoryCardActivity in your case (full path best package plus activity with dots (full stop's separating things, normally no slashes).

VERY VERY important: com.heyjude.heyjudeapp/com.usebutton.sdk.internal.GroupedInventoryCardActivity is reffering to a library Activity (also with a package name the forward slash links the two packages). That's o.k.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.html2pdf"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"         />    
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"        />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.html2pdf.Html2pdfActivity"
            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>

So package (replace/change):

package="com.heyjude.heyjudeapp"

and (replace/change/insert) Activity (name):

<activity
android:name="com.heyjude.heyjudeapp/com.usebutton.sdk.internal.GroupedInventoryCardActivity"

Hope this helps and not make it more confusing ;O)

Jon Goodwin
  • 9,053
  • 5
  • 35
  • 54
0

All that goes into the AndroidManifest.xml file is this:

<application

    <activity
      <!-- your activities  -->
    </activity>

    <!--Button SDK-->
    <meta-data android:name="com.usebutton.applicationid" android:value="YOUR_BUTTON_APP_ID"/>
</application>

Did you remember to replace "YOUR_BUTTON_APP_ID" with your Button app ID found in the dashboard?

mr_napster
  • 21
  • 3