質問

I am developing a Firefox addon and would like to test it on Android. I have downloaded Nightly on the phone and have root access.

Inside of the addon's directory, I run the following command:

cfx run -a fennec-on-device -b /bin/adb --mobile-app fennec --force-mobile

as according to the documentation.

Nightly is then opened up on my phone and I get the following output at the terminal:

Launching mobile application with intent name org.mozilla.fennec
Pushing the addon to your device
Starting: Intent { act=android.activity.MAIN cmp=org.mozilla.fennec/.App (has extras) }

But there is no debug output whatsoever. I have tried putting console.log statements at the top of my main.js and the first content script that is supposed to load.

Is this a common problem? What else can I check? If more specific information is necessary, please post a comment.

役に立ちましたか?

解決

I realise this question is almost a year old but I was having similar issues until I found a Mozilla Bugzilla issue reporting that cfx test wasn't showing results without "-v" (https://bugzilla.mozilla.org/show_bug.cgi?id=773028)

I added "-v" to my "cfx run", making it:

cfx run -v -a fennec-on-device -b "C:\Users\Ben\AppData\Local\Android\android-sdk\platform-tools\adb.exe" --mobile-app fennec --force-mobile

..and suddenly I actually get some info beyond "Starting: Intent"...

Running cfx for attached Android device... Launching mobile application with intent name org.mozilla.fennec Pushing the addon to your device Starting: Intent { act=android.activity.MAIN cmp=org.mozilla.fennec/.App (has extras) } --------- beginning of /dev/log/main --------- beginning of /dev/log/system Could not read chrome manifest 'file:///data/data/org.mozilla.fennec/chrome.manifest'. OpenGL compositor Initialized Succesfully. Version: OpenGL ES 2.0 Vendor: ARM Renderer: Mali-400 MP FBO Texture Target: TEXTURE_2D Adding HealthReport:RequestSnapshot observer. Sending snapshot message. main.js starting console.log: tldr: main.js starting ....

他のヒント

I found a workaround to get debug output by wrapping my entire main.js in a try/catch block like so:

try {
  var pageMod = require("sdk/page-mod");

  pageMod.PageMod({/* etc */});

  // etc.

}
catch (e) {
  console.log(e);
}

I then test my app using --mobile-app firefox instead of --mobile-app fennec as @nmaier suggested in a comment.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top