离子框架 - 的Config.xml [英] Ionic framework - Config.xml

查看:196
本文介绍了离子框架 - 的Config.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要修改config.xml文件,所以编译为Android,当我把这些权限:

 <使用许可权的android:NAME =android.permission.INTERNET对/>
<使用许可权的android:NAME =android.permission.ACCESS_NETWORK_STATE/>

我就是这么做的,在config.xml中:

 <平台名称=机器人>
    <图标SRC =资源\\机器人\\图标\\绘-LDPI-的icon.png密度=LDPI/>
    <图标SRC =资源\\机器人\\图标\\绘-MDPI-的icon.png密度=MDPI/>
    <图标SRC =资源\\机器人\\图标\\绘-HDPI-的icon.png密度=华电国际/>
    <图标SRC =资源\\机器人\\图标\\绘-xhdpi-的icon.png密度=xhdpi/>
    <图标SRC =资源\\机器人\\图标\\绘-xxhdpi-的icon.png密度=xxhdpi/>
    <图标SRC =资源\\机器人\\图标\\绘-xxxhdpi-的icon.png密度=xxxhdpi/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘,土地LDPI-screen.png密度=土地LDPI/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘,土地MDPI-screen.png密度=土地MDPI/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘,土地HDPI-screen.png密度=土地华电国际/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘,土地xhdpi-screen.png密度=土地xhdpi/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘,土地xxhdpi-screen.png密度=土地xxhdpi/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘,土地xxxhdpi-screen.png密度=土地xxxhdpi/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘端口-LDPI-screen.png密度=港LDPI/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘端口-MDPI-screen.png密度=港MDPI/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘端口-HDPI-screen.png密度=港华电国际/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘端口-xhdpi-screen.png密度=港xhdpi/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘端口-xxhdpi-screen.png密度=港xxhdpi/>
    <飞溅SRC =资源\\机器人\\飞溅\\绘端口-xxxhdpi-screen.png密度=港xxxhdpi/>     < preference NAME =Android系统的minSdkVersionVALUE =10/>
    < preference NAME =Android的targetSdkVersionVALUE =21/>    <配置文件中的目标=AndroidManifest.xml中父=/ *>
        <支持屏
            机器人:anyDensity =真
            机器人:largeScreens =真
            机器人:normalScreens =真
            机器人:调整大小=真
            机器人:smallScreens =真
            机器人:xlargeScreens =真/>
        <使用许可权的android:NAME =android.permission.INTERNET对/>
        <使用许可权的android:NAME =android.permission.ACCESS_NETWORK_STATE/>        <应用
            机器人:hardwareAccelerated =真
            机器人:图标=@绘制/图标
            机器人:标签=@字符串/ APP_NAME
            机器人:supportsRtl =真正的>            <活动
                机器人:configChanges =方向| keyboardHidden |键盘|屏幕尺寸|区域
                机器人:标签=@字符串/ ACTIVITY_NAME
                机器人:launchMode =singleTop
                机器人:名字=MainActivity
                机器人:主题=@安卓风格/ Theme.Black.NoTitleBar
                 机器人:windowSoftInputMode =adjustResize>                <意向过滤器的android:标签=@字符串/ LAUNCHER_NAME>
                    <作用机器人:名字=android.intent.action.MAIN/>
                    <类机器人:名字=android.intent.category.LAUNCHER/>
                &所述; /意图滤光器>
            < /活性GT;
        < /用途>
    < /配置-文件>  < /平台>

但是当生成清单只具有网​​络的权限,而不是许可权

1 是错了吗?我必须手动添加权限,AndroidManifest.xml中?

和另一个查询:

2 如何显示字符串LAUNCHER_NAME的价值?在string.xml可以在编译步骤为默认值时改变它,但


解决方案

  1. 有不应该在短短手动添加它到AndroidManifest.xml中任何的伤害,这样可能是你最好的选择。

对于这两个1和2,只是为了确认,您正在编辑的config.xml文件是在项目的基础?还有就是获取平台/安卓/ RES创造了一个又一个/ XML,你不应该因为编辑它总是会被替换。

I need to modify the config.xml file, so when compiling for Android I take these permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

I did it this way, in config.xml:

<platform name="android">
    <icon src="resources\android\icon\drawable-ldpi-icon.png" density="ldpi"/>
    <icon src="resources\android\icon\drawable-mdpi-icon.png" density="mdpi"/>
    <icon src="resources\android\icon\drawable-hdpi-icon.png" density="hdpi"/>
    <icon src="resources\android\icon\drawable-xhdpi-icon.png" density="xhdpi"/>
    <icon src="resources\android\icon\drawable-xxhdpi-icon.png" density="xxhdpi"/>
    <icon src="resources\android\icon\drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
    <splash src="resources\android\splash\drawable-land-ldpi-screen.png" density="land-ldpi"/>
    <splash src="resources\android\splash\drawable-land-mdpi-screen.png" density="land-mdpi"/>
    <splash src="resources\android\splash\drawable-land-hdpi-screen.png" density="land-hdpi"/>
    <splash src="resources\android\splash\drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
    <splash src="resources\android\splash\drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
    <splash src="resources\android\splash\drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
    <splash src="resources\android\splash\drawable-port-ldpi-screen.png" density="port-ldpi"/>
    <splash src="resources\android\splash\drawable-port-mdpi-screen.png" density="port-mdpi"/>
    <splash src="resources\android\splash\drawable-port-hdpi-screen.png" density="port-hdpi"/>
    <splash src="resources\android\splash\drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
    <splash src="resources\android\splash\drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
    <splash src="resources\android\splash\drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>

     <preference name="android-minSdkVersion" value="10" />
    <preference name="android-targetSdkVersion" value="21" />

    <config-file target="AndroidManifest.xml" parent="/*"> 
        <supports-screens 
            android:anyDensity="true" 
            android:largeScreens="true" 
            android:normalScreens="true" 
            android:resizeable="true" 
            android:smallScreens="true" 
            android:xlargeScreens="true" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />    

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

            <activity 
                android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" 
                android:label="@string/activity_name" 
                android:launchMode="singleTop" 
                android:name="MainActivity" 
                android:theme="@android:style/Theme.Black.NoTitleBar"
                 android:windowSoftInputMode="adjustResize">

                <intent-filter android:label="@string/launcher_name">
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    </config-file>

  </platform>

But then when generating manifest has only the INTERNET permission, not ACCESS_NETWORK_STATE.

1. Is that wrong? Must I add the permission manually to the AndroidManifest.xml?

And another query:

2. How do I indicate the value for the string "launcher_name"? In string.xml can change it, but when compiling steps to a default value.

解决方案

  1. There shouldn't be any harm in just adding it manually to the AndroidManifest.xml so that is probably your best option.

For both 1 and 2, just to confirm, you are editing the config.xml that is at the base of your project? There is another one that gets created in platform/android/res/xml that you should not be editing because it will always be replaced.

这篇关于离子框架 - 的Config.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆