mozilla / apk-factory-service

Web service which converts Open Web Apps into native Android apps
42 stars 18 forks source link

Debuggable APK doesn't work, showing the Example Domain page #83

Closed kyoshino closed 9 years ago

kyoshino commented 9 years ago

I'd like to debug my app for kyoshino/bzdeck#194. The APK file was generated with mozilla-apk-cli and installed successfully, but when I launch the app on Android, it shows the Example Domain page. I have tried both hosted and packaged app but no luck. Maybe the app origin is not set, loading http://example.com/ instead?

kumar303 commented 9 years ago

Hi. Were you following these instructions to build a debuggable APK? https://hacks.mozilla.org/2014/06/testing-your-native-android-app/ If so, could you provide some more specific steps you took to build the APK?

kyoshino commented 9 years ago

Yes, I simply run:

sudo npm install -g mozilla-apk-cli
mozilla-apk-cli https://www.bzdeck.com/manifest.webapp bzdeck_test.apk
adb install bzdeck_test.apk

I know the example in the Hacks blog doesn't work because the first argument of mozilla-apk-cli should be a manifest file URL, not an app origin.

kumar303 commented 9 years ago

@mykmelez or @jhugman do you have any insight into what might be the problem?

kyoshino commented 9 years ago

When I run adb shell pm list packages -f, I can find these APKs:

Marketplace app:

package:/data/app/com.bzdeck.www.pdbd1946af5036bfc617e60a885a8a485-1.apk=com.bzdeck.www.pdbd1946af5036bfc617e60a885a8a485

Debuggable APK:

package:/data/app/com.example.pa9b9f04336ce0181a08e774e01113b31-1.apk=com.example.pa9b9f04336ce0181a08e774e01113b31
mykmelez commented 9 years ago

Hmm, no, I don't know why this is happening. It could be a problem with the CLI, but it could also be an issue with the APK Factory instance that the CLI is using to generate these APKs. If you use the --endpoint flag to make the CLI use the production APK factory server, then you could compare the two APKs to see if there are differences between the files.

cc: @wfwalker so he's aware of this issue.

kyoshino commented 9 years ago

Any chance to see the issue solved? I had to disable BzDeck's Android compatibility on the Firefox Marketplace. :tired_face:

kyoshino commented 9 years ago

A traditional window.alert debugging have found that it's an issue in my Web Activities code, so I have just disabled the feature in my app. It's difficult to solve the issue without a debuggable APK.

kyoshino commented 9 years ago

Another Android WebAppRT issue found on my app: https://github.com/bzdeck/bzdeck/issues/293

kumar303 commented 9 years ago

I'll ping some folks about who could maybe look at this. The original author is no longer at Mozilla so I'm not sure who's maintaining it.

ozten commented 9 years ago

I'm happy to take a look at this in the next couple of days.

ozten commented 9 years ago

Can you try

mozilla-apk-cli --overrideManifest https://www.bzdeck.com/manifest.webapp https://www.bzdeck.com/manifest.webapp bzdeck_test.apk

example.com is provided by the cli app, but should be overwritten server side. This isn't happening, I've not identified why yet. By specifying an explicit overrideManifest we won't end up with example.com.

I looked in the classes.dex file and am seeing com.bzdeck.www in the package names, so hopefully this will work.

ozten commented 9 years ago

mozilla-apk-cli version 0.0.10 is now published. It automatically sets overrideManifest for building hosted apps.