是的,我知道这个问题已经被问过很多次了,但没有一个答案对我真正有用?我想也许有人只需要解释我的代码。
我的应用程序在 SplashScreen.java 上启动 10 秒,然后应该加载 MainActivity.java 。但是,当我运行我的应用程序时,它会启动 SplashScreen,但 10 秒后,MainActivity 不会加载,并且应用程序说它已停止。
我检查了运行日志,它显示“android.content.ActivityNotFoundException:无法找到显式活动类 {com.msp.supercarsounds/com.msp.supercarsounds.MainActivity};您是否在 AndroidManifest.xml 中声明了此活动?” AndroidManifest.xml:<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.msp.supercarsounds">
<uses-sdk android:minSdkVersion="17"
android:targetSdkVersion="22"/>
<uses-permission
android:name="android.permission.INTERNET"/>
<application
android:largeHeap="true"
android:allowBackup="true"
android:icon="@mipmap/carsounds_logo"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="com.msp.supercarsounds.SplashScreen"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<activity
android:name="com.msp.supercarsounds.MainActivity" />
<activity
android:name=".AudiPrimary"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name="com.msp.supercarsounds.RegisterApplication"
android:label="Register Appliction"
android:theme="@style/AppTheme" />
<activity
android:name="com.msp.supercarsounds.Porsche"
android:label="Porsche"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name="com.msp.supercarsounds.MercedesBenz"
android:label="Mercedes-Benz"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name="com.msp.supercarsounds.Lamborghini"
android:label="Lamborghini"
android:theme="@style/AppTheme" />
<activity
android:name="com.msp.supercarsounds.Ferrari"
android:label="Ferrari"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" …Run Code Online (Sandbox Code Playgroud)java android android-manifest android-activity android-studio
我尝试设置just_audio_background但出现了一堆错误(如屏幕截图所示),当我遵循 main/AndroidManifest.xml 的修订并且不确定为什么似乎完全按照插件概述的步骤进行操作时。
我收到的警告是:
运行应用程序时出现的异常原因是:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> com.android.manifmerger.ManifestMerger2$MergeFailureException: Error parsing /Users/mac/Documents/flutter_projects/zense_timer_project/zense_timer/android/app/src/main/AndroidManifest.xml
Run Code Online (Sandbox Code Playgroud)
这是 AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<application
android:label="zense_timer"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name="com.ryanheise.audioservice.AudioServiceActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this …Run Code Online (Sandbox Code Playgroud) 我目前正在尝试在我的应用中实施搜索。我遵循了Google的教程,但是现在,当我按下“搜索”按钮(位于设备/仿真器上)时,什么也没出现。我不知道为什么。
我的searchable.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<searchable
xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/label_search"
android:hint="@string/search_hint"
android:includeInGlobalSearch="true"
>
</searchable>
Run Code Online (Sandbox Code Playgroud)
这是Search-Activity的Android清单部分:
<!-- Search Activity -->
<activity android:name=".SearchNotes">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
Run Code Online (Sandbox Code Playgroud)
填充我的ListActivity的代码:
private void searchAndDisplay(String query){
SQLiteDatabase db = db_con.getReadableDatabase();
final Cursor c = db.rawQuery(
"SELECT headline, id as '_id' FROM entry WHERE " +
"(headline LIKE '%?%') OR (content LIKE '%?%') ",
new String[]{query, query});
this.startManagingCursor(c);
final ListAdapter searchAdapter = new SimpleCursorAdapter(
this,
android.R.layout.simple_list_item_2, c,
new …Run Code Online (Sandbox Code Playgroud) 我之所以宣布<user-permission android:name="android.permission.INTERNET" />,是AndroidManifest因为我认为这是获得用户许可的首选方法。
但是我得到了这个警告:"Element user-permission not allowed here"
通过快速的Google搜索,我无法弄清楚问题所在或最佳实践是什么。
我正在使用SDK 21及更高版本。
我想要更改启动器图标,但不会更改它。我按照其他SO帖子中的说明进行操作。
我的代码有什么问题?提前致谢。
这是清单:
application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
Run Code Online (Sandbox Code Playgroud) 我尝试使用查询包还在清单中添加了意图过滤器,但所有应用程序都显示我只需要 upi 应用程序
我正在将应用程序上载到Android PlayStore中,并且由于其中的SMS权限而被拒绝,但是在Manifest.xml文件中没有添加SMS权限。
与Google小组进行对话后,他们说短信允许使用,但我找不到。
以下是Google团队提供的屏幕截图,并且该屏幕截图具有短信权限。
我的清单文件看起来像这样
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.msonline.android">
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application
android:name=".ApplicationClass"
android:allowBackup="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/MSOAppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning"
tools:replace="android:allowBackup,android:icon,android:label,android:theme">
//Other declarations of Activities
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
预先感谢任何帮助。
编辑#1
build.gradle
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "package name"
minSdkVersion 16
targetSdkVersion 28
versionCode 31
versionName "4.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary …Run Code Online (Sandbox Code Playgroud) android android-manifest android-permissions developer-console