My script can install my apk fine but cannot launch it because it cannot find the activity. My android gradle project structure is src/main/java/com/me.android/main/MainActivity. My script:
File projectDir = new File(System.getProperty("user.dir"));
File app = new File(projectDir, APK_NAME);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "My S6");
capabilities.setCapability("platformVersion", "5.1");
String absPath = app.getAbsolutePath();
capabilities.setCapability("app", absPath);
capabilities.setCapability("appPackage", "com.me.android.internal.debug");
capabilities.setCapability("appActivity", ".main.MainActivity");
driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
According http://appium.io/slate/en/master/?ruby#appium-server-capabilities, appPackage is “Java package of the android app you want to run”. Running the following command gave me “com.me.android.internal.debug”:
./aapt dump badging ~/myAndroidApp/mobile/build/outputs/apk/mobile-internal-debug-
unaligned.apk | grep package:\ name
My manifest says:
<activity
android:name=".main.MainActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.myApp">
android:theme="@style/Theme.xyx.Theme2"
android:label="@string/start_name"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
I also tried com.me.android.internal.debug.main with just .MainActivity