Dis*_*had 8 javascript android manifest android-studio react-native
我刚刚创建了一个 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.
Run Code Online (Sandbox Code Playgroud)
并以下面的错误结束..
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
Run Code Online (Sandbox Code Playgroud)
这是我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>
Run Code Online (Sandbox Code Playgroud)
请指导我,如果我遗漏了什么,请告诉我。我对本机反应很陌生。
我遇到了同样的问题,就我而言,问题是当我创建 flutter 项目时,我将组织名称指定为 in.mycompany (观察,“in”)。现在,“in”似乎是 Dart 中的关键字,因此 Android Studio 在它生成的文件中使用“in”。然而,这让 Gradle 不高兴,并导致它生成消息说 name 必须是有效的 Java 包名称。真是一个难题:)
解决办法是在整个项目中搜索`in`.mycompany这个字符串,并在build.gradle和AndroidManifest.xml文件中将其更改为in.mycompany(这样的文件有几个,搜索一下即可)。但在 kotlin 文件 MainActivity.kt 中将其保留为“in”
这为我解决了。
| 归档时间: |
|
| 查看次数: |
4775 次 |
| 最近记录: |