<activity>标签中的'android:name'必须是React Native中的有效Java类名称

时间:2019-01-11 11:07:45

标签: javascript android react-native android-manifest

我刚刚创建了一个React-native应用程序,并构建了React Native应用程序,给了我下面的错误。

H:\App Data\ejob-app\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:2: AAPT: error: attribute 'package' in <manifest> tag is not a valid Android package name: 'com.ejob-app'.

H:\App Data\ejob-app\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:17: AAPT: error: attribute 'android:name' in <application> tag must be a valid Java class name.

H:\App Data\ejob-app\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:24: AAPT: error: attribute 'android:name' in <activity> tag must be a valid Java class name.

最后出现以下错误。

FAILURE: Build failed with an exception.

* Where:
Build file 'H:\App Data\ejob-app\android\app\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'.
> Plugin with id 'com.ejob.app' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --        
debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and 
have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

这是我的AndroidManifest.xml,用于检查所需的配置。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ejob-app"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="16"
    android:targetSdkVersion="26" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
    android:name="com.ejob-app.MainApplication"
    android:allowBackup="false"
    android:debuggable="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.ejob-app.MainActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:label="@string/app_name"
        android:windowSoftInputMode="adjustResize" >
        <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>

请对此进行指导,如果我缺少某些东西,请告诉我。我对本机很陌生。

1 个答案:

答案 0 :(得分:2)

包裹名称不应包含破折号。从

重命名您的软件包
  

'com.ejob-app'

  

'com.ejob_app'

您可以关注this question