android multiple activity declaration in manifest

后端 未结 5 1804
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 20:33

I have a main activity. From it, I am calling 2 other sub activities called FacebookLogin and Twitterlogin. I am using the following code in AndroidManufest.xml:

         


        
相关标签:
5条回答
  • 2020-12-10 20:46

    Maybe you have tested it already but just try declaring your activities with the full path (although you have already declared it in the package tag). So, instead of using

    <activity android:name=".TwitterLogin"  />
    

    use

    <activity android:name="com.examples.Kikin.TwitterLogin" />
    

    Sometimes problems are caused because of that.

    I know this is an old thread but Im having the same problem and in my case specifying full package name doesnt help. Have you already found a solution? I`m really interested in knowing how to avoid this error.

    0 讨论(0)
  • 2020-12-10 20:48

    The manifest you posted looked fine.

    But regarding your comment about the error message "Have you declared this activity in AndroidManifest.xml?", you need to check carefully the package and class name of the Activity you are trying to launch, and make sure that it matches the <activity android:name> you have written in the manifest.

    All the info you need should be in the error message.

    0 讨论(0)
  • 2020-12-10 20:53

    The labels for your FacebookLogin and TwitterLogin appear to be missing an '@' - change them to android:label="@string/app_name"

    0 讨论(0)
  • 2020-12-10 20:56

    Don't nest activity declarations, just have them all as elements in your application element:

    <manifest ...
      <application ...
        <activity ...
        </activity>
        <activity ...
        </activity>
        <activity ...
        </activity>
      </application>
    </manifest>
    

    The sample you posted here (indenting aside) looks fine.

    0 讨论(0)
  • 2020-12-10 21:03

    There's no such thing as a "subactvity". Just because you call one activity from another doesn't mean it's a "subactivity".

    You can't nest activity tags in the manifest and you'd probably get a compile error if you tried.

    in manifest you can set only one activity in launcher tag okay android does support multiple launcher activity.

    0 讨论(0)
提交回复
热议问题