I have not found the solution to this online. All of my activities are declared, however often Android Studio will tell me it does not find them. It doesn't always occur, and it seems to happen quite randomly. I've cleaned, invalidated and restarted, rebuild, sometimes this will get fixed then start happening again after some time. I'm working in a team on the project, and I seem to be the only one with the bug:
<?xml version="1.0" encoding="utf-8"?>
<manifest package="fall2018.csc2017.GameCentre"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SlidingTiles.SlidingGameActivity" />
<activity android:name=".Score.MenuScoreboardsActivity" />
<activity android:name=".Score.UserScoreboardActivity" />
<activity android:name=".Score.ScoreScreenActivity" />
<activity android:name=".Score.GameScoreboardActivity" />
<activity android:name=".GameLauncherActivity" />
<activity android:name=".RegisterActivity" />
<activity android:name=".SlidingTiles.SlidingTilesStartingActivity" />
<activity android:name=".Simon.SimonGameActivity" />
<activity android:name=".Simon.SimonStartingActivity" />
<activity android:name=".ChooseDimensionActivity"></activity>
</application>
This is my gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "fall2018.csc2017.GameCentre"
minSdkVersion 27
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
It is hard to tell what is the exact issue based on the only information you provided. But, few things you can try to find the issue:
Try running your app on a different physical device or emulator. If
it fixes it, that means that was a device issue.
Set breakpoints on all of your onCreate methods activities, as well as the previous code snippet where the activity will be launching the following activity, for example:
Intent intent = new Intent(context, className);
intent.setFlags(intFlag);
context.startActivity(intent);
And try to debug to see if the activity is being created or being launched. This could be a good start to narrow down the problem. Good luck!
FYI, switch this line :
<activity android:name=".ChooseDimensionActivity"></activity>
to this:
<activity android:name=".ChooseDimensionActivity"/>
Related
So, I am a beginner into Android and Kotlin. I just began learning. While I was experimenting with Intent today, I incurred an error.
Manifest merger failed with multiple errors, see logs
I found some solutions here and tried to implement them, but it did not work.
This is my build.gradle :
`
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 33
defaultConfig {
applicationId "com.example.chattery"
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleDependency
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-auth:21.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.firebase:firebase-database:20.1.0'
implementation 'com.google.firebase:firebase-storage:20.1.0'
implementation 'com.google.firebase:firebase-messaging:23.1.0'
implementation 'com.google.firebase:firebase-auth-ktx:21.1.0'
implementation 'com.google.firebase:firebase-database-ktx:20.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'com.mikhaellopez:circularimageview:4.2.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.firebaseui:firebase-ui-database:4.3.0'
implementation 'id.zelory:compressor:3.0.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation 'com.squareup.okhttp:okhttp:2.7.5'
}
`
This is my AndroidManifest :
`
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chattery">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name=".commons.ChatteryApplication"
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">
<activity android:name=".ui.activities.ChatActivity"
android:theme="#style/ActivityActionBarTheme"
android:parentActivityName=".ui.activities.MainActivity"/>
<activity
android:name=".ui.activities.SettingsActivity"
android:parentActivityName=".ui.activities.MainActivity" />
<activity android:name=".ui.activities.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.activities.WelcomeActivity"
android:screenOrientation="portrait"
android:theme="#style/LoginTheme" />
<activity
android:name=".ui.activities.SignUpActivity"
android:parentActivityName=".ui.activities.WelcomeActivity"
android:theme="#style/ActivityActionBarTheme" />
<activity
android:name=".ui.activities.LoginActivity"
android:parentActivityName=".ui.activities.WelcomeActivity"
android:theme="#style/ActivityActionBarTheme" />
<activity
android:name=".ui.activities.UsersActivity"
android:parentActivityName=".ui.activities.SettingsActivity"
android:theme="#style/ActivityActionBarTheme" />
<activity android:name=".ui.activities.ProfileActivity">
<intent-filter>
<action android:name="com.example.chattery.NOTIFICATION_TARGET" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="#style/Base.Theme.AppCompat" />
<service
android:name=".firebase.MessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
`
This is my Merging Errors :
Merging Errors:
Error: android:exported needs to be explicitly specified for element <activity#com.example.chattery.ui.activities.MainActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Chattery.app main manifest (this file), line 23 Error: android:exported needs to be explicitly specified for element <activity#com.example.chattery.ui.activities.ProfileActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. Chattery.app main manifest (this file), line 46
This is my first week with coding, I am sorry if this is a really silly thing. I am really new to this and did not find any other place to ask. Sorry if I broke any rules
Error Message
As the error message suggests you might want to add android:exported to your activity definition. It also informs you about the fact, that this is only the case for targetSdk >= 31. So another solution would be to lower you targetSdk. But that would come with some feature tradeoffs. I wouldn't recommend that.
Solution 1 (Recommended)
According to this statement here. Google suggests not setting this property unnecessarily to true
So the simplest solution would be to change this in your AndroidManifest.xml:
<activity android:name=".ui.activities.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
To this:
<activity android:name=".ui.activities.MainActivity" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Notice the added android:exported attribute.
Solution 2 (Not Recommended)
In your module level gradle.build you have somewhere at the top the property targetSdk. Change the value to something lower than 31 eg. 30 which corresponds to Android 11. Mind that you need to download the required target sdk via the sdk manager. Otherwise you won't be able to compile your app anymore
I tried integrating google maps API in my android application but I keep getting a blank grey screen. Attaching manifest and build.gradle file. The activity file contains the default code that comes while creating a google maps activity. You can clearly see this in manifest file.
I have mentioned the API key. I think the issue lies in dependencies, I might not have included every library that requires in order to run the app but I am not able to figure it out.
Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mppolice">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<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/Theme.MPPolice">
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow the directions here:
https://developers.google.com/maps/documentation/android-sdk/get-api-key
Once you have your API key (it starts with "AIza"), define a new property in your
project's local.properties file (e.g. MAPS_API_KEY=Aiza...), and replace the
"YOUR_API_KEY" string in this file with "${MAPS_API_KEY}".
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY"/>
<activity
android:name=".NearbyPolice"
android:exported="false"/>
<activity
android:name=".More"
android:exported="false" />
<activity
android:name=".WomanHelpline"
android:exported="false" />
<activity
android:name=".Statistics"
android:exported="false" />
<activity
android:name=".MissingPerson"
android:exported="false" />
<activity
android:name=".NearbyOffenders"
android:exported="false" />
<activity
android:name=".Contacts"
android:exported="false" />
<activity
android:name=".CrimeReport"
android:exported="false" />
<activity
android:name=".PasswordActivity"
android:exported="false" />
<activity
android:name=".AuthScreen"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="false"
android:label="#string/title_activity_main"
android:theme="#style/Theme.MPPolice.NoActionBar" />
<activity
android:name=".SplashScreen"
android:exported="true"
android:theme="#style/Theme.MPPolice.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Build.gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
apply plugin: 'com.google.gms.google-services'
android {
compileSdk 31
defaultConfig {
applicationId "com.example.mppolice"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation "androidx.cardview:cardview:1.0.0"
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'
implementation 'com.google.firebase:firebase-auth:21.0.7'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-location:20.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation platform('com.google.firebase:firebase-bom:30.3.1')
implementation 'com.google.firebase:firebase-analytics'
}
I recently uploaded my game on play store. The game works fine in my mobile. but i tried to install it in my friends(3-4) mobile phones it gives below error.
Your device isnt compatible with this version
Here is my android manifest
<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">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-8853085470060311~2582555526"/>
<service
android:name="com.ak.fulligola.MusicService"
android:enabled="true" />
<activity android:name="com.ak.fulligola.HomePage">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.ak.fulligola.MainActivity" />
<activity android:name="com.ak.fulligola.CharacterSelection" />
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
Below is my build.gradle
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.ak.fulligola"
minSdkVersion 28
targetSdkVersion 29
versionCode 2
versionName "2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.gms:play-services-ads:19.2.0'
}
Please help to solve.
Also i have ads in my game. so do i need to provide internet permission.?
Your application supports only Android Pie (9) and Android Q(10) only.
To support vast number of devices, please change minSdkVersion to 23 and update target version to latest available i.e. 30.
Yes, Internet permission is required to show the Ads.
I tried using the Glide library in order to load a profile picture from Facebook, in the gradle I implemented the 4.8.0 version (which is not the latest) and it made this error :
ERROR: Failed to parse XML in C:\Users\Paul Jouet\Desktop\ESILV\S5\Mobile Programming\ProjetTest2\app\src\main\AndroidManifest.xml
ParseError at [row,col]:[18,89]
Message: expected start or end tag
Affected Modules: app
My manifest module has disappeared, it is still in my project and I can open it, but not from the 'android' section... When I tried syncing again without the implementation, the error remains, I tried some solutions I found like cleaning the project and rebuild it, but none worked.
This is how the 'android' section looks like after the failed syncing, the module 'manifest' is missing even though it is still in the same location as before
Can someone explain to me how this can happen ? It makes no sense to me since I obviously deleted the part causing the problem... The only solution I could find is to recreate a project from scratch and copy paste all my code, but this is not viable since it can happen again.
Thank you for helping !
Edit : here are my manifest and gradle codes
Gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.projettest2"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.facebook.android:facebook-android-sdk:4.42.0'
implementation 'de.hdodenhof:circleimageview:3.0.1'
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
}
}
Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.projettest2">
<uses-permission android:name="android.permission.INTERNET"/>
<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">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:authorities="com.facebook.app.FacebookContentProvider464643414180175" //I changed the ID
android:name="com.facebook.FacebookContentProvider"
android:exported="false" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"/>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges= "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<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:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
</application>
</manifest>
I published an Android app on the google play store but it says that it is incompatible with ALL devices:
Why is this? Just before this, I published another app and it really wasn't that much different from this one but it is compatible with almost all devices.
This is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.yy" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/app"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- register our ContentProvider -->
<provider
android:name=".data.app"
android:authorities="#string/content_authority"
android:exported="false"
android:syncable="true" />
<activity
android:name=".DetailActivity"
android:label="#string/title_activity_detail"
android:parentActivityName=".FavoritesActivity"
android:launchMode="singleTask">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xxx.yyy.MainActivity" />
>
</activity>
<activity
android:name=".FavoritesActivity"
android:label="#string/title_activity_favorites"
android:parentActivityName=".MainActivity"
android:launchMode="singleTask">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xxx.yyy.MainActivity" />
</activity>
</application>
</manifest>
And this is my gradle.build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.xxx.yy"
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'org.json:json:20150729'
compile 'org.apache.directory.studio:org.apache.commons.codec:1.8'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.android.support:design:22.2.0'
}
I'm really lost here because I only have one permission, INTERNET..
I found out the culprit!
It was this line in my gradle file:
compile 'org.apache.directory.studio:org.apache.commons.codec:1.8'
This weird: Native platforms thing was showing up before all because of that gradle dependency!
Which does not make sense for me... I guess I have to find another dependency or something. Could someone explain to me why a dependency like that would cause this to happen?
I removed that line and upon reuploading my APK I now see this:
You appear to have an extra > in your manifest --
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xxx.yyy.MainActivity" />
> <==== DELETE THIS
</activity>
<activity
Not sure why your even able to make a build with that, but I tested a similar scenario and it made an APK for me. I would guess when you upload the .apk that is messing with google play's parsing for device compatibility.