所以我得到的MainActivity不存在错误,可能是因为我将包和应用从bomber
重命名为Bomber
并将appId从com.bomber
更改为{{ 1}}
我已经检查了AndroidManifest,活动源文件和build.gradle文件,但我似乎无法找到错误
错误消息
cool.bomber.android
应用程序/的build.gradle
Starting: Intent { cmp=cool.bomber.android/.MainActivity }
Error type 3
Error: Activity class {cool.bomber.android/cool.bomber.android.MainActivity} does not exist.
AndroidMaifest.xml
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "cool.bomber.android"
...
机器人/应用/ SRC /主/ JAVA /冷却/轰炸机/机器人/ MainActivity.java
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="com.google.intent.category.CARDBOARD" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="foo.app.goo.gl" android:scheme="http"/>
<data android:host="foo.app.goo.gl" android:scheme="https"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
我不确定我还应该考虑调试什么。
答案 0 :(得分:1)
在清单中添加包名称:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cool.bomber.android">
并且仍然无法写出像这样的完整包名
<application
android:name="cool.bomber.android.MainApplication"
android:allowBackup="true" >
<activity
android:name="cool.bomber.android.MainActivity"
>
并确保这是正确的路径
并在CMD中写下:
cd android & gradlew clean
or maybe
cd android && ./gradlew clean
而不是运行react-native run-android
确保在编写此代码时,您位于项目文件夹的根目录
或者其他:
使用android studio更改包后,按this刷新整个项目。
答案 1 :(得分:0)
对我来说,问题是我已在我的android / app / src / debug / AndroidManifest.xml中添加了 tools:node =“ replace” :
h2
我已经添加了它,因为有人针对其他问题推荐了它,并导致了臭名昭著的Error type 3的出现。一旦摆脱它,问题就消失了:
<script>
let saveFile = () => {
// Get the data from each element on the form.
const fname = document.getElementById('txtFname');
const email = document.getElementById('txtEmail');
const mobilenmb = document.getElementById('txtMobilenmb');
const adr = document.getElementById('txtAdr');
const city = document.getElementById('txtCity');
const state = document.getElementById('txtState');
const zip = document.getElementById('txtZip');
const quantity = document.getElementById('txtQuantity');
// This variable stores all the data.
let data =
'\r Name: ' + fname.value + ' \r\n ' +
'Email: ' +email.value + ' \r\n ' +
'MobileNumber: ' + mobilenmb.value + ' \r\n ' +
'Address: ' + adr.value + ' \r\n ' +
'City: ' + city.value + ' \r\n ' +
'State: ' + state.value + ' \r\n ' +
'Zip: ' + zip.value + ' \r\n ' +
'Quantity: ' + quantity.value;
// Convert the text to BLOB.
const textToBLOB = new Blob([data], { type: 'text/plain' });
const sFileName = 'formData.txt'; // The file to save the data.
let newLink = document.createElement("a");
newLink.download = sFileName;
if (window.webkitURL != null) {
newLink.href = window.webkitURL.createObjectURL(textToBLOB);
}
else {
newLink.href = window.URL.createObjectURL(textToBLOB);
newLink.style.display = "none";
document.body.appendChild(newLink);
}
newLink.click();
}
</script>
干杯, 阿尔瓦罗
答案 2 :(得分:0)
我必须重新安装应用程序才能解决问题
答案 3 :(得分:0)
您需要正确卸载应用程序。
如果手机不行,可以用cmd
adb uninstall "package name"