首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自动生成代码并获得错误

自动生成代码并获得错误
EN

Stack Overflow用户
提问于 2018-07-02 12:21:21
回答 4查看 53关注 0票数 1

我在<uses-permission android:name="android.permission.INTERNET" />中使用了AndroidManifest.xml代码,但错了行,我试图更改不同的行,结果出错了。如果删除此行,则在运行或清理或重新构建时,<uses-permission android:name="android.permission.INTERNET" />将自动添加错误行中的代码。我什么都不能想。以下是代码:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.berkancalikoglu.deadbydaylightguide"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="27" />

    <application
        android:allowBackup="true"
        android:debuggable="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:testOnly="true"
        android:theme="@style/AppTheme" >
        <uses-permission android:name="android.permission.INTERNET" />

        <activity android:name="com.berkancalikoglu.deadbydaylightguide.Main36Activity" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

</manifest>
EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2018-07-02 12:21:51

  1. 使用-许可必须位于应用程序标记之上。
  2. 您可以删除uses-sdk.从build.gradle部分进行维护。
  3. 不要编辑auto-generate Manifest文件。

试着

代码语言:javascript
复制
 <uses-permission android:name="android.permission.INTERNET" />

 <application
        android:allowBackup="true"
        android:debuggable="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:testOnly="true"
        android:theme="@style/AppTheme" >

然后是Clean-Rebuild-Run.

票数 1
EN

Stack Overflow用户

发布于 2018-07-02 12:27:29

您正在编辑自动生成的清单。您应该从源编辑(在src dir中),而不是编辑生成的( build dir)。

票数 1
EN

Stack Overflow用户

发布于 2018-07-02 12:30:26

Google使用应用程序清单中声明的元素从不符合其硬件和软件功能要求的设备中筛选应用程序。

通过指定应用程序所需的功能,可以使Google Play只向设备满足应用程序功能要求的用户展示应用程序,而不是向所有用户展示应用程序。

有关Google如何使用功能作为过滤基础的重要信息,请阅读下面的Google Play和基于特征的过滤

因此,您应该在<application>...</application> 标记的外部定义您的用户权限。

例如:

代码语言:javascript
复制
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="27" />

    <application
        android:allowBackup="true"
        android:debuggable="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:testOnly="true"
        android:theme="@style/AppTheme" >

        ...

</application>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51136136

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档