2017-08-08 41 views
1

我嘗試註冊我的應用程序到Android的共享功能,我發現我必須修改清單。如何修改Meteor 1.5 Cordova App中的AndroidManifest.xml?

我所做的:

App.appendToConfig(` 
<universal-links> 
    <host name="com.toto.app" /> 
</universal-links> 
<platform name="android"> 
    <config-file target="AndroidManifest.xml" parent="/manifest/application/activity"> 
      <intent-filter>    
       <action android:name="android.intent.action.SEND" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
       <data android:mimeType="*/*" />     
      </intent-filter>  
    </config-file> 
</platform> 
`); 

新線出現在config.xml但目的過濾器沒有出現在清單中,並不會產生應用程序。

這裏是錯誤消息

=> Started your app. 

=> App running at: http://localhost:3000/ 
    Type Control-C twice to stop. 

=> Errors executing Cordova commands: 

    While running Cordova app for platform Android with options --device: 
    Error: Command failed: C:\dev\Talkalang_V41\.meteor\local\cordova-build\platforms\android\cordova\run --device --device 
    Note: Some input files use or override a deprecated API. 
    Note: Recompile with -Xlint:deprecation for details. 
    Note: Some input files use or override a deprecated API. 
    Note: Recompile with -Xlint:deprecation for details. 
    C:\dev\Talkalang_V41\.meteor\local\cordova-build\platforms\android\res\xml\config.xml:60: AAPT: Error parsing XML: unbound prefix 

    C:\dev\Talkalang_V41\.meteor\local\cordova-build\platforms\android\build\intermediates\res\merged\debug\xml\config.xml:60: error: Error parsing XML: unbound prefix 

回答

0

你需要的屬性xmlns:android="http://schemas.android.com/apk/res/android"每一個引用的Android命名空間元素。在你的情況,這意味着:

App.appendToConfig(` 
<universal-links> 
    <host name="com.toto.app" /> 
</universal-links> 
<platform name="android"> 
    <config-file target="AndroidManifest.xml" parent="/manifest/application/activity"> 
      <intent-filter>    
       <action android:name="android.intent.action.SEND" xmlns:android="http://schemas.android.com/apk/res/android" /> 
       <category android:name="android.intent.category.DEFAULT" xmlns:android="http://schemas.android.com/apk/res/android" /> 
       <data android:mimeType="*/*" xmlns:android="http://schemas.android.com/apk/res/android" />     
      </intent-filter>  
    </config-file> 
</platform> 
`); 
+0

科爾多瓦 - 自定義配置:錯誤更新的平臺「Android的配置:無法元素 – Marc

+0

更換/艙單上使用絕對路徑。解決了這個問題,但所有這些都沒有影響。換句話說,我從圖庫應用程序分享圖片,但我的應用程序無法顯示在要共享的應用程序列表中。 – Marc

+0

順便說一句,我試圖按照https://ourcodeworld.com/articles/read/101/how-to-list-your-cordova-app-in-open-with-menu-in-android-and-handle-意向事件......迄今爲止沒有成功。 – Marc

相關問題