cordova run android executes fine. But Android 4.1.2 doesn't start the app

后端 未结 7 448
悲哀的现实
悲哀的现实 2020-12-02 19:04

I\'m starting to develop and android app using Cordova 5.0.0 (cordova -v prints 5.0.0), and testing it on a Moto Razr D1 with Android 4.1.2. Under Windows 7, btw.

         


        
相关标签:
7条回答
  • 2020-12-02 19:41

    Changing the code in device.js and emulator.js didn't work for me (and in fact introduced an error where cordova build android wouldn't work anymore). My problem was completely different: I had two <application>s in my AndroidManifest.xml which is apparently not allowed.

    Somewhere along the line I had added <application android:debuggable="true" /> to my AndroidManifest.xml. However, that file already had an "application" element that looked like this:

    <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">

    So I added the "debuggable" line to the existing <application> (and removed the second <application>) like so:

    <application android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">

    After that I rebuilt using cordova build android, ran it successfully on my device with cordova run android, and then clapped my hands and scared my dog.

    HOWEVER, even if this isn't your issue, here's how I discovered the problem: I followed the instructions in jojo's answer and ran adb logcat with my device connected. That terminal tab immediately filled up with interminable crap.

    Then I opened a new terminal window that I could view at the same time, I took note of the latest timestamp in the logcat output, and I ran cordova run android. The screen filled up with more crap, and then once things calmed down I scrolled back up to my starting time and reviewed it line by line. Eventually I found my culprit:

    PackageParser: <manifest> has more than one <application>

    Hope this helps!

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