2017-08-08 59 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

相关问题