Reputation: 3739
After I added a activity-alias, the build fails with:
error: attribute 'android:name' in <activity-alias> tag must be a valid Java class name.
Even if the Android Developers documentation says, the name doesn't have refer to an actual class.
android:name
A unique name for the alias. The name should resemble a fully qualified class name. But, unlike the name of the target activity, the alias name is arbitrary; it does not refer to an actual class.
Here's my activity declaration:
...
<activity android:name=".MainActivity" />
<activity-alias
android:name="MainActivity-2"
android:targetActivity=".MainActivity"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
...
Upvotes: 1
Views: 3068
Reputation: 1279
Its clear here that we can choose any unique name for the alias but what's not clear is that the unique name should be a valid class name (i.e. name should not contain "-", space, special character, etc.).
Thats why you are getting your error(error: attribute 'android:name' in <activity-alias> tag must be a valid Java class name.
) while building your application.
Upvotes: 9