My App Crash every time I send a One Signal Push notification.
note: firebase has no issue also one signal inApp message working fine. also, Receive push notification of one signal with crash
with firebase, it has no issue but I want to use one signal I tries so many things but not working
Here is my error from logcat
The Error
2021-07-20 22:10:37.431 14322-16493/###### E/AndroidRuntime: FATAL EXCEPTION: Firebase-Messaging-Intent-Handle
Process: #######, PID: 14322
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.messaging.RemoteMessage$Notification.getTitle()' on a null object reference
at ######.MyFirebaseMessagingService.onMessageReceived(MyFirebaseMessagingService.java:17)
at com.google.firebase.messaging.FirebaseMessagingService.dispatchMessage(com.google.firebase:firebase-messaging##22.0.0:13)
at com.google.firebase.messaging.FirebaseMessagingService.passMessageIntentToSdk(com.google.firebase:firebase-messaging##22.0.0:8)
at com.google.firebase.messaging.FirebaseMessagingService.handleMessageIntent(com.google.firebase:firebase-messaging##22.0.0:3)
at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(com.google.firebase:firebase-messaging##22.0.0:3)
at com.google.firebase.messaging.EnhancedIntentService.lambda$processIntent$0$EnhancedIntentService(com.google.firebase:firebase-messaging##22.0.0:1)
at com.google.firebase.messaging.EnhancedIntentService$$Lambda$0.run(Unknown Source:6)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement##17.5.0:6)
at java.lang.Thread.run(Thread.java:764)
Here are my codes
I have added both the firebase class and one signal class in the manifest file
Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="######"
android:installLocation="auto">
<!--
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="26" />
-->
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true" />
<application
android:name=".AppController"
android:allowBackup="false"
>
<activity android:name=".activity.MainActivity" />
<activity
android:name=".activity.SplashScreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
android:name=".activity.SettingActivity"
android:label=""
android:theme="#style/Theme.AppCompat.Light.Dialog" />
<activity
android:name=".activity.InstructionActivity"
android:label="My Custom AppIntro"
android:theme="#style/Theme.Intro" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="#string/admob_app_id" />
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true" />
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#drawable/notification_yellow" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="#color/colorAccent" />
<meta-data android:name="com.onesignal.NotificationAccentColor.DEFAULT"
android:value="#FFCC00" />
<activity android:name=".activity.ReviewActivity" />
<activity android:name=".activity.BookmarkList" />
<activity android:name=".AboutUs" />
<activity android:name=".About" />
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
</application>
</manifest>
Build. Gradle (app)
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "#########"
minSdkVersion 17
targetSdkVersion 30
versionCode 1
versionName "1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
archivesBaseName = "Offline Quiz"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation 'com.google.firebase:firebase-inappmessaging-display:20.0.0'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.android.gms:play-services-ads:19.4.0'
implementation 'com.google.android.gms:play-services-plus:17.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'com.google.android.gms:play-services-games:21.0.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.github.AppIntro:AppIntro:6.1.0'
implementation 'io.github.dreierf:material-intro-screen:0.0.6'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
// One signal SDK
implementation 'com.onesignal:OneSignal:4.4.1'
// firebase
implementation platform('com.google.firebase:firebase-bom:28.2.1')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
}
apply plugin: 'com.google.gms.google-services'
Build.Gradle(project)
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.8'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.13.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
maven {
url "https://maven.google.com"
}
google()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Firebase class
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import org.jetbrains.annotations.NotNull;
public class MyFirebaseMessagingService extends FirebaseMessagingService {
#Override
public void onMessageReceived( RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
getFirebaseMessage(remoteMessage.getNotification().getTitle(),remoteMessage.getNotification().getBody());
}
public void getFirebaseMessage (String title, String msg)
{
NotificationCompat.Builder builder = new NotificationCompat.Builder(this,"myFirebasechannel")
.setSmallIcon(R.drawable.ic_notification_test)
.setContentTitle(title)
.setContentText(msg)
.setAutoCancel(true);
NotificationManagerCompat manger=NotificationManagerCompat.from(this);
manger.notify(101,builder.build());
}
}
This fixed the problem for me: https://stackoverflow.com/a/45268868/9878385
I had to add implementation "com.google.firebase:firebase-core:16.0.1" or similar into app/build.gradle
Related
I am working on a version of an Android app and I would like to release a new update. The app compiles well, but when I try to generate a release apk or bundle, I always get the same Gradle errors that I cannot solve, as I don´t understand the problem. I have been wrapping my head around this for days, so I would be thankful for any help or hints.
This is the error log of the failing gradle task:
> Task :app:processReleaseMainManifest
/Users/dwa2112/Development/Template/Template/app/src/main/AndroidManifest.xml:31:5-235:19 Warning:
application#android:icon was tagged at AndroidManifest.xml:31 to replace other declarations but no other declaration present
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
/Users/dwa2112/Development/Template/Template/app/src/main/AndroidManifest.xml:57:9-67:20 Error:
android:exported needs to be explicitly specified for element <receiver#com.onesignal.GcmBroadcastReceiver>. 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.
/Users/dwa2112/Development/Template/Template/app/src/main/AndroidManifest.xml:109:9-114:20 Error:
android:exported needs to be explicitly specified for element <receiver#com.onesignal.BootUpReceiver>. 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.
/Users/dwa2112/Development/Template/Template/app/src/main/AndroidManifest.xml:115:9-119:20 Error:
android:exported needs to be explicitly specified for element <receiver#com.onesignal.UpgradeReceiver>. 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.
This is my Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.sherdle.universal">
<!-- Always Required to get content and check if internet is available -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Always Required for image coaching & maps -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Required for notifications & radio -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Required for maps -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Required for visualizer & radio -->
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" />-->
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- Required for tumblr -->
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<!-- Required for in-app purchases -->
<uses-permission android:name="com.android.vending.BILLING" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:name=".App"
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:icon">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<!-- Activities -->
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize"
android:exported="true"
android:label="#string/app_name"
android:theme="#style/AppTheme.Launcher"
tools:node="merge" />
<activity
android:name=".login.LoginActivity"
android:configChanges="orientation|screenSize"
android:exported="true"
android:label="#string/app_name"
android:theme="#style/AppTheme.Launcher"
tools:node="merge" />
<activity
android:name="com.onesignal.NotificationOpenedActivityHMS"
android:exported="false"
android:theme="#style/Theme.CanPostThis2.SplashTheme"
tools:replace="android:theme"
tools:node="merge" />
<activity
android:name=".SplashScreenActivity"
android:exported="true"
android:theme="#style/Theme.CanPostThis2.SplashTheme"
tools:node="merge">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".picer_lib.activity.ImagePickActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="#style/vw_FilePickerTheme"
tools:node="merge" />
<activity
android:name=".picer_lib.activity.ImageBrowserActivity"
android:exported="true"
android:hardwareAccelerated="false"
android:screenOrientation="portrait"
android:theme="#style/vw_FilePickerTheme"
tools:node="merge" />
<service
android:name=".Fcm.MyFirebaseMessagingService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".Fcm.GCMRegistrationIntentService"
android:exported="true"
tools:node="merge">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<activity
android:name=".picer_lib.activity.VideoPickActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="#style/vw_FilePickerTheme"
tools:node="merge" />
<activity
android:name=".picer_lib.activity.AudioPickActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="#style/vw_FilePickerTheme"
tools:node="merge" />
<activity
android:name=".picer_lib.activity.NormalFilePickActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="#style/vw_FilePickerTheme"
tools:node="merge" />
<activity android:name=".providers.rss.ui.RssDetailActivity" />
<activity android:name=".providers.videos.ui.VideoDetailActivity" />
<activity android:name=".providers.wordpress.ui.WordpressDetailActivity" />
<activity android:name=".providers.woocommerce.ui.ProductActivity" />
<activity
android:name=".comments.CommentsActivity"
android:configChanges="orientation|screenSize" />
<activity
android:name=".HolderActivity"
android:configChanges="orientation|screenSize" />
<activity
android:name=".attachmentviewer.ui.AttachmentActivity"
android:configChanges="orientation|screenSize" />
<activity
android:name=".attachmentviewer.ui.AudioPlayerActivity"
android:configChanges="orientation|screenSize" />
<activity
android:name=".attachmentviewer.ui.VideoPlayerActivity"
android:configChanges="orientation|screenSize" />
<activity
android:name=".providers.woocommerce.ui.CheckoutActivity"
android:configChanges="orientation|screenSize" />
<activity
android:name=".providers.woocommerce.ui.WooCommerceLoginActivity"
android:configChanges="orientation|screenSize"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".providers.videos.player.YouTubePlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="sensor"
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen" />
<!-- Services -->
<service
android:name=".providers.audio.player.player.PlaybackService"
android:exported="true"
tools:node="merge" />
<service android:name=".providers.radio.player.RadioService" />
<service android:name=".attachmentviewer.MusicService" />
<!--
A receiver that will receive media buttons and send as
intents to your MediaBrowserServiceCompat implementation.
Required on pre-Lollipop. More information at
http://developer.android.com/reference/android/support/v4/media/session/MediaButtonReceiver.html
-->
<receiver
android:name="androidx.media.session.MediaButtonReceiver"
android:exported="true"
tools:node="merge">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
<receiver
android:name=".providers.audio.player.media.MediaSessionReceiver"
android:exported="true"
tools:node="merge">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
<!--<receiver android:name=".providers.soundcloud.player.player.PlayerReceiver">
<intent-filter>
<action android:name="android.media.AUDIO_BECOMING_NOISY" />
</intent-filter>
</receiver>-->
<!-- Meta Data -->
<meta-data
android:name="com.onesignal.NotificationOpened.DEFAULT"
android:exported="true"
android:value="DISABLE"
tools:node="merge" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:exported="true"
android:value="#string/google_maps_key"
tools:node="merge" />
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:exported="true"
android:value="true"
tools:node="merge" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="true"
android:grantUriPermissions="true"
tools:node="merge">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths" />
</provider>
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="${applicationId}.firebaseinitprovider"
android:exported="false"
tools:node="remove" />
</application>
</manifest>
This is my build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
name 'Google'
}
google()
maven {
url 'https://jitpack.io'
}
}
}
buildscript {
ext.kotlin_version = '1.7.10'
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.jaredsburrows:gradle-license-plugin:0.8.80'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.14.0'
}
repositories {
google()
maven {
url 'https://plugins.gradle.org/m2/'
}
maven {
url 'https://maven.google.com/'
}
jcenter()
}
}
ext {
supportlib_version = '29.0.0'
gps_version = '[16.0.0, 17.0.0)'
fb_version = '[16.0.0, 18.0.0)'
}
allprojects {
repositories {
google()
jcenter()
}
}
This is my build.gradle for the module:
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'com.jaredsburrows.license'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
/*
* To update licenses, run:
* - cd [project location]
* - ./gradlew licenseReleaseReport
*/
licenseReport {
generateHtmlReport = true
generateJsonReport = false
// These options are ignored for Java projects
copyHtmlReportToAssets = true
copyJsonReportToAssets = false
}
android {
compileSdkVersion 33
defaultConfig {
applicationId "com.webagenten.canpostthis"
minSdkVersion 19
targetSdkVersion 33
multiDexEnabled true
versionCode 12
versionName "7.0"
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
//Optionally configure your OneSignal IDs below
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "",
onesignal_google_project_number: ""]
}
signingConfigs {
release {
storeFile file("")
storePassword ""
keyAlias ""
keyPassword ""
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
}
dexOptions {
jumboMode true
}
applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
variant.mergeAssets.doLast {
delete(fileTree(dir: variant.mergeAssets.outputDir, includes: ['x86/ffmpeg', '**/*.ffmpeg']))
}
}
variant.getRuntimeConfiguration().exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
}
repositories {
flatDir {
dirs 'libs'
}
maven {
url "https://jitpack.io"
}
mavenCentral()
jcenter()
}
dependencies {
implementation 'com.devbrackets.android:exomedia:4.3.0' //TV
implementation 'com.google.android.exoplayer:exoplayer:2.18.2' //TV & Radio
implementation 'com.cleveroad:audiovisualization:1.0.1' //Radio
implementation 'com.google.code.gson:gson:2.8.9' //WC
implementation 'com.squareup.okhttp3:okhttp:3.12.1' //WC
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
// Faceook SDK
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'com.facebook.android:facebook-core:[4,5)'
implementation 'com.facebook.android:facebook-marketing:[4,5)'
implementation 'com.onesignal:OneSignal:[3.13.0, 3.99.99]'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.duolingo.open:rtl-viewpager:1.0.2'
implementation 'com.github.chrisbanes:PhotoView:1.3.0'
implementation 'com.github.ed-george:AndroidVimeoExtractor:1.2.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.multidex:multidex-instrumentation:2.0.0'
implementation 'androidx.exifinterface:exifinterface:1.3.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.media:media:1.2.1'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.google.android.gms:play-services-ads:19.0.1'
implementation "com.google.android.gms:play-services-maps:17.0.0"
implementation 'com.google.android.material:material:1.3.0'
implementation "com.android.billingclient:billing:3.0.2"
implementation 'com.google.firebase:firebase-ads:19.0.1'
implementation 'com.google.firebase:firebase-analytics:18.0.2'
implementation 'com.google.firebase:firebase-crashlytics:17.3.1'
implementation 'com.google.firebase:firebase-messaging:21.0.1'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation 'androidx.fragment:fragment:1.1.0'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.onesignal:OneSignal:3.16.1'
implementation('com.squareup.picasso:picasso:2.71828') {
exclude group: "com.github.vansikrishna:Multimager:1.0.8", module: "jetified-Multimager-1.0.8-runtime"
}
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.duolingo.open:rtl-viewpager:1.0.2'
implementation 'com.github.chrisbanes:PhotoView:1.3.0'
implementation 'com.github.ed-george:AndroidVimeoExtractor:1.2.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.multidex:multidex-instrumentation:2.0.0'
implementation 'androidx.exifinterface:exifinterface:1.3.5'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.media:media:1.6.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation project(path: ':imagepicker')
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.google.android.gms:play-services-ads:21.4.0'
implementation "com.google.android.gms:play-services-maps:18.1.0"
implementation 'com.google.android.material:material:1.7.0'
implementation "com.android.billingclient:billing:5.1.0"
implementation 'com.google.firebase:firebase-ads:21.4.0'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
implementation 'com.google.firebase:firebase-crashlytics:18.3.2'
implementation 'com.google.firebase:firebase-messaging:23.1.1'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation 'androidx.fragment:fragment:1.5.5'
debugImplementation 'androidx.fragment:fragment-testing:1.5.5'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.crystal:crystalrangeseekbar:1.1.3'
implementation 'com.github.vansikrishna:Multimager:1.0.8'
implementation 'com.google.android.gms:play-services-ads:21.4.0'
implementation 'mobi.upod:time-duration-picker:1.1.3'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
//implementation 'com.arthenica:mobile-ffmpeg-full:4.2.2.LTS'
implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.2.2.LTS'
}
I would appreciate any hints or help, as I simply don´t understand what´s wrong here, as the mentioned receivers in the error log are simply not part of the manifest.
Well, actually, I am a newbie to android. I have been trying to develop an app that has google maps, and everything was going fine until today when I got this error from the emulator.
Here are some files in case it may be helpful.
Manifest XML file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.uaproject">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<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.UAProject">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".Hotels"
android:exported="true"
android:parentActivityName=".HomeScreen" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />
<activity
android:name=".NoteEditorActivity"
android:exported="true"
android:parentActivityName=".HomeScreen" />
<activity
android:name=".AboutApp"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".Copyrights"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".ToAboutBayanOlgey"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".ToAboutUs"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".Menu"
android:exported="true"
android:parentActivityName=".HomeScreen" />
<activity
android:name=".HomeScreen"
android:exported="true" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
build.gradle-app level
plugins {
id 'com.android.application'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.uaproject"
minSdk 19
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_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation 'com.github.smarteist:autoimageslider:1.3.9'
implementation 'com.google.android.material:material:<version>'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
build.gradle-root level
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.1"
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
PS: By the way, if you guys have time, could you please guide me on how to add google maps to an already-created fragment(for example, my fragment is the one of a bottom navigation). I have been searching but all I tried did not work for some reason. Or just a link to the valid way would do because there seemed to be many obsolete approaches to this as well, which we beginners cannot really discern.
I have a step counter Andriod app, I have to upload it on playstore and it's not working with targetSDKversion defined as playstore needs a API level 29+
and this default API is 28 (Playstore Console told)
this is the /build.gralde file
buildscript {
repositories {
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.4'
if (rootProject.ext.has("gradle_classpath")) {
classpath rootProject.ext.gradle_classpath
} else {
logger.warn('classpath not found in rootProject')
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.google.gms:google-services:4.3.4'
}
}
}
allprojects {
repositories {
jcenter()
maven{url "https://jitpack.io"}
google()
mavenCentral()
}
}
apply plugin: 'com.android.application'
android {
if (rootProject.ext.has("compileSdkVersion")) {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
} else {
logger.warn('compileSdkVersion not found in rootProject')
compileSdkVersion = 30
buildToolsVersion = "30.0.3"
}
defaultConfig {
applicationId "com.j4velin.pedometer"
minSdkVersion 21
multiDexEnabled true
}
flavorDimensions "main"
productFlavors {
fdroid {
dimension "main"
}
}
lintOptions{
disable 'MissingTranslation'
disable 'ExtraTranslation'
}
buildTypes {
release {
signingConfig signingConfigs.release
zipAlignEnabled true
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
debug {
debuggable true
signingConfig signingConfigs.release
zipAlignEnabled true
minifyEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 30
buildToolsVersion '30.0.3'
}
repositories {
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.github.j4velin.colorpicker:colorpicker:1.20.6'
implementation 'com.github.j4velin.EazeGraph:EazeGraph:1.0.3'
implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.github.Shashank02051997:FancyToast-Android:0.1.8'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation platform('com.google.firebase:firebase-bom:26.3.0')
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.firebase:firebase-database:19.6.0'
playImplementation 'com.google.android.gms:play-services-identity:17.0.0'
implementation 'org.jsoup:jsoup:1.10.2'
implementation 'com.ogaclejapan.smarttablayout:library:2.0.0#aar'
implementation 'com.ogaclejapan.smarttablayout:utils-v4:2.0.0#aar'
}
apply plugin: 'com.google.gms.google-services'
This is working and app is working fine and counting steps
but when I add targetSDKVersion
defaultConfig {
applicationId "com.j4velin.pedometer"
minSdkVersion 21
multiDexEnabled true
targetSdkVersion 30 //APP STOPS COUNTING STEPS
}
This is my AndroidManifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.shubham.pedo"
android:versionCode="1"
android:versionName="1.0.0">
<uses-feature
android:name="android.hardware.sensor.stepcounter"
android:required="true" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION"/>
<uses-permission android:name="android.permission.WAKE_LOCK" android:maxSdkVersion="30" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.DeviceDefault.Light.DarkActionBar"
tools:replace="label">
<activity
android:name=".AboutActivity"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
android:exported="true"/>
<activity
android:name=".PEDOMETER.Google_Sign_In"
android:screenOrientation="portrait"
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>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light"/>
<receiver android:name=".PEDOMETER.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name=".PEDOMETER.AppUpdatedReceiver">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<service android:name=".PEDOMETER.SensorListener" />
<service
android:name=".PEDOMETER.widget.DashClock"
android:permission="com.google.android.apps.dashclock.permission.READ_EXTENSION_DATA">
<intent-filter>
<action android:name="com.google.android.apps.dashclock.Extension" />
</intent-filter>
<meta-data
android:name="protocolVersion"
android:value="2" />
<meta-data
android:name="worldReadable"
android:value="true" />
<meta-data
android:name="description"
android:value="Displays the steps taken today" />
</service>
<activity
android:name=".PEDOMETER.widget.WidgetConfig"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Holo.Dialog.NoActionBar">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<receiver android:name=".PEDOMETER.widget.Widget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget" />
</receiver>
<service
android:name=".PEDOMETER.widget.WidgetUpdateService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>
</manifest>
Everything is working fine without adding targetSDKVersion, with adding this playstore accepts release apk but that stops counting the steps of User
The issue started when updating my phone from Android 8 to 9.
The app was working perfectly before.
I tried to replicate this in some other app I am working on, by including the same dependencies/configuration, but I am unable to replicate the behavior. It always crashes at the setContentView, even for a simple activity and simple layout.
I did my research and came to the conclusion that INTERACT_ACROSS_USERS_FULL permission is not the real cause of the issue.
This crash actually happens in all app activities, but the TestActivity is the simplest one. Tested on Samsung S9+ running API 28 and Pixel Emulator running Android 9, API 28.
EDIT: This seems to happen when I put the android:name="...." attribute to the manifest definition. Since I really need the application class, I'm still in search of a solution to make this work.
The activity (simplified to have the minimum code needed for a crash):
package com.marhat.albatros
import android.os.Bundle import androidx.appcompat.app.AppCompatActivity;
class TestActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_test)
}
}
Layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TestActivity">
</androidx.coordinatorlayout.widget.CoordinatorLayout>
This is the output:
2019-02-08 11:54:19.088 20298-20298/com.marhat.albatros E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.marhat.albatros, PID: 20298
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.marhat.albatros/com.marhat.albatros.TestActivity}:
java.lang.SecurityException: Call from user 0 as user 1 without
permission INTERACT_ACROSS_USERS or INTERACT_ACROSS_USERS_FULL not
allowed.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.SecurityException: Call from user 0 as user 1 without permission INTERACT_ACROSS_USERS or
INTERACT_ACROSS_USERS_FULL not allowed.
at android.os.Parcel.createException(Parcel.java:1942)
at android.os.Parcel.readException(Parcel.java:1910)
at android.os.Parcel.readException(Parcel.java:1860)
at android.view.accessibility.IAccessibilityManager$Stub$Proxy.addClient(IAccessibilityManager.java:295)
at android.view.accessibility.AccessibilityManager.tryConnectToServiceLocked(AccessibilityManager.java:1125)
at android.view.accessibility.AccessibilityManager.(AccessibilityManager.java:358)
at android.view.accessibility.AccessibilityManager.getInstance(AccessibilityManager.java:336)
at android.view.View.setFlags(View.java:14008)
at android.view.View.(View.java:5565)
at android.view.ViewGroup.(ViewGroup.java:659)
at android.view.ViewGroup.(ViewGroup.java:655)
at android.view.ViewGroup.(ViewGroup.java:651)
at android.view.ViewGroup.(ViewGroup.java:647)
at android.widget.FrameLayout.(FrameLayout.java:78)
at com.android.internal.policy.DecorView.(DecorView.java:255)
at com.android.internal.policy.PhoneWindow.generateDecor(PhoneWindow.java:2310)
at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2662)
at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2071)
at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:575)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.marhat.albatros.TestActivity.onCreate(TestActivity.kt:9)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.accessibility.AccessibilityManagerService$SecurityPolicy.resolveCallingUserIdEnforcingPermissionsLocked(AccessibilityManagerService.java:3522)
at com.android.server.accessibility.AccessibilityManagerService.addClient(AccessibilityManagerService.java:487)
at android.view.accessibility.IAccessibilityManager$Stub.onTransact(IAccessibilityManager.java:82)
at android.os.Binder.execTransact(Binder.java:731)
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.marhat.albatros">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:name="android.hardware.usb.host"
android:required="true"/>
<uses-feature android:name="android.hardware.location.gps"/>
<application
android:name=".AlbatrossApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_icon_main"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_icon_main_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".TestActivity"
android:label="#string/title_activity_test"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".TasksActivity"
android:label="#string/title_activity_tasks"
android:theme="#style/AppTheme.NoActionBar"/>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="xxx"/>
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<service
android:name=".UsbService"
android:enabled="true"/>
<activity android:name=".FPViewActivity"/>
<activity
android:name=".SplashActivity"
android:theme="#style/AppTheme.Launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".TaskViewActivity"
android:theme="#style/AppTheme">
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:mimeType="*/*"/>
<data android:scheme="file"/>
<data android:scheme="content"/>
<data android:pathPattern=".*\\.xfd"/>
<data android:host="*"/>
</intent-filter>
</activity>
<activity
android:name=".SettingsActivity"
android:windowSoftInputMode="stateVisible|adjustResize"/>
</application>
</manifest>
Project gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.25.4'
} }
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
maven {
url "https://jitpack.io"
}
} }
task clean(type: Delete) {
delete rootProject.buildDir }
The app / gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.marhat.albatros"
minSdkVersion 18
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
implementation 'com.android.support:multidex:1.0.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.android.support:appcompat-v7:28'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
implementation 'com.github.QuadFlask:colorpicker:0.0.13'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.android.support:support-core-utils:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
def room_version = "2.1.0-alpha04"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
def lifecycle_version = "2.0.0"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version"
testImplementation "androidx.arch.core:core-testing:$lifecycle_version"
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
}
apply plugin: 'com.google.gms.google-services'
The issue was with the application class implementing a method called getUserId.
After renaming the method everything started to work on Android 9 again.
i finally found the solution it's work.... charm
1) -> Copy Parse to you Manifest
<!--Support Android Pie 9-->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature" />
2) -> Find and replace all getUserId Occurrence
for Mac user:use Cmd+Shift+R
Example on MAC
https://i.stack.imgur.com/eLtWR.png
I decided to update an old app, sadly when I try to sync the project I'm getting the following Gradle Sync error:
"ERROR: Failed to parse XML in C:...\app\src\main\AndroidManifest.xml
ParseError at [row,col]:[17,9]
Message: expected start or end tag
Affected Modules: app"
After doing my research and forums, the problem seems to be in the AndroidManifest (duh!) when I go to the line 17 I find the Meta-data of my app, and if I add some lines before this, the error moves accordingly to the line.
I have also updated the Gradle to 4.10.1, the Android Plugin version is 3.3.1; and I'm using the "Default Gradle Wrapper"
Here is the Manifest Code
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myPackage">
<application
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="#drawable/gordotoken"
android:label="#string/app_name"
android:roundIcon="#drawable/gordotoken"
android:supportsRtl="true"
android:theme="#style/AppTheme">
///META DATA
<meta-data
android:name="com.google.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"/>
<activity
android:name="myPackage.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="myPackage.dvd" />
<activity android:name="myPackage.dvai" />
<activity android:name="myPackage.dvaicat" />
<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>
<provider android:authorities="com.facebook.app.FacebookContentProvider{xxx}"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
Here is the build.gradle for the app
apply plugin: 'com.android.application'
android {
signingConfigs {
configRelease {
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('C:MyKey.jks')
storePassword 'xxx'
}
}
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
applicationId 'myApp'
minSdkVersion 27
targetSdkVersion 27
versionCode 17
versionName "1.14"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.configRelease
}
}
productFlavors {
}
}
dependencies {
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation ('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:mediarouter-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android:flexbox:0.2.5'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.github.bumptech.glide:glide:4.3.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services:11.8.0'
implementation 'com.google.android.gms:play-services-games:11.8.0'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
}
apply plugin: 'com.google.gms.google-services'
Here is the build.gradle for the project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'll appreciate if someone could point me in the right direction as I seem to be missing some tags in my manifest and at this point I don;t know what I'm doing wrong here :(
Thank you all before hand for your help! :)
Remove below line from your manifest.xml file
///META DATA
And replace it with below comments syntax
<!—- META DATA —->
As pointed out here already to comment in XML we shouldn't be using /// but <!-- > instead.
Please replace /// META DATA with <!-- META DATA-> and that should work.
If you want to make comment in xml file, you need to use <!--your comment here--> this tag. // or /**/ doesn't work
I also faced the same issue, where removing the comments from
//this is a comment
to
<!--this is a comment-->
worked for me.