Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
&引用;未找到与给定名称匹配的资源..:“0”Android Studio 2.1.2(React原生应用程序)_Android_Android Studio_React Native_Android Studio 2.1 - Fatal编程技术网

&引用;未找到与给定名称匹配的资源..:“0”Android Studio 2.1.2(React原生应用程序)

&引用;未找到与给定名称匹配的资源..:“0”Android Studio 2.1.2(React原生应用程序),android,android-studio,react-native,android-studio-2.1,Android,Android Studio,React Native,Android Studio 2.1,在为ios开发react原生应用程序之后,我还想在android上测试它 在遵循文档中的步骤并设置Android Studio进行测试后,我很遗憾无法运行该应用程序,因为我似乎没有找到正确的解决方案。尽管以前也有人问过类似的问题 错误: Error:(6, -1) Android Resource Packaging: [ios_ver] /path/ios_ver/android/app/src/main/AndroidManifest.xml:6: error: Error: No reso

在为ios开发react原生应用程序之后,我还想在android上测试它

在遵循文档中的步骤并设置Android Studio进行测试后,我很遗憾无法运行该应用程序,因为我似乎没有找到正确的解决方案。尽管以前也有人问过类似的问题

错误:

Error:(6, -1) Android Resource Packaging: [ios_ver] /path/ios_ver/android/app/src/main/AndroidManifest.xml:6: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(6, -1) Android Resource Packaging: [ios_ver] /path/ios_ver/android/app/src/main/AndroidManifest.xml:6: error: Error: No resource found that matches the given name (at 'icon' with value '@mipmap/ic_launcher').
Error:(6, -1) Android Resource Packaging: [ios_ver] /path/ios_ver/android/app/src/main/AndroidManifest.xml:6: error: Error: No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
Error:(11, -1) Android Resource Packaging: [ios_ver] /path/ios_ver/android/app/src/main/AndroidManifest.xml:11: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name').
我问了我的一个Android开发者朋友,但他只说他从来不需要编辑清单文件,也没有类似的问题

我的清单文件:

我很高兴听到你的任何解决办法。 谢谢你的帮助

更新

模块设置

单击+添加库时,会弹出以下窗口:


不幸的是,我没有看到任何库的列表,我可以从中选择appcompat-v7。

修复React本机应用程序:

您必须通过命令react native run android运行它,如官方文档中所述

如果未使用React-Native,请修复:

您的
Android清单
文件缺少运行应用程序所需的某些内容。其中大部分都在

从列表中选择appcompat-v7


我成功地模拟了这个react原生android应用程序

虽然您可以直接从Xcode运行react本机IOS应用程序, 如果您直接从Android Studio运行react原生Android应用程序,那么它似乎不起作用


必须通过命令react native run android运行它,如文档中所述

您在“活动”下编写的一些内容正在我的代码中应用。那有关系吗?我已经试用了你的代码,并用我的代码替换了这些条目,但仍然出现相同的错误:/Sure。更新了我的问题!另外,我的res/values/strings.xml的定义如您的答案所示:)谢谢或更新的答案,不幸的是,我仍然收到相同的错误。您可以发布build.gradle文件吗?让我们在里面看一看。用Buffel.Goelle文件更新我的问题:
    <uses-permission android:name="android.permission.INTERNET" />

    <application
      android:allowBackup="true"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
        android:debuggable="true"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>
</manifest>
apply plugin: "com.android.application"

import com.android.build.OutputFile


apply from: "../../node_modules/react-native/react.gradle"


def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 21
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.ios_ver"
        minSdkVersion 21
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-fs')
    compile project(':react-native-image-picker')
    compile project(':react-native-mail')
    compile project(':react-native-camera')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
  from configurations.compile
  into 'libs'
}
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.prad.myapplication">

     <application
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
         android:supportsRtl="true"
         android:theme="@style/AppTheme">
         <activity
             android:name=".MainActivity"
             android:label="@string/app_name"
             android:theme="@style/AppTheme.NoActionBar">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
                 <category android:name="android.intent.category.LAUNCHER"/>
             </intent-filter>
         </activity>
    </application>
 </manifest>
<string name="app_name">"MyFirstApp"</string>
 <!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Light">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>
android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        minSdkVersion 21 
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
}