I am trying to build a what's app application but when I try to implement android image cropper in build.gradle it gave me some error like this
"ERROR: Failed to parse XML in
H:\Project\WhatsApp2\app\src\main\AndroidManifest.xml ParseError at
[row,col]:[17,9] Message: expected start or end tag Affected Modules:
app "
My code is given below
Android Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.whatsapp2">
<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"/>
<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">
tools:replace="android:appComponentFactory"
<activity android:name=".PhoneLoginActivity"></activity>
<activity android:name=".GroupChatActivity" />
<activity android:name=".SettingsActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity" />
<activity android:name=".RegisterActivity" />
</application>
</manifest>
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.whatsapp2"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
}
What should I do now?
For those, who still get an error even after adding dependency:
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
If your error may be something like:
Classes of CropImage Library were not auto suggested by IDE, then you must ensure this maven { url 'https://jitpack.io' } and jcenter() in your project level build.gradle file.
Like this:
buildscript {
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.google.gms:google-services:4.3.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
It must work in that scenario. Hope! it helps.
For Temporary solution you can downgrade version as below:
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
instead of
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
Note : This error is regarding android jetpacks that may be updated in library.
First convert your project into androidx by refactoring
Refactor-> Migrate to AndroidX -> Migrate
or add below lines in gradle.properties and manually change all widgets into androidx
android.useAndroidX=true
android.enableJetifier=true
And change this
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
into
api 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
You were missing a ">" closing tag, do it like :
<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"/>
<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"
tools:replace="android:appComponentFactory">
<activity android:name=".PhoneLoginActivity"/>
<activity android:name=".GroupChatActivity" />
<activity android:name=".SettingsActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity" />
<activity android:name=".RegisterActivity" />
</application>
Update : As you see there is an error in you AndroidManifest.xml file stating :
expected start or end tag Affected Modules: app
If you using below version of library
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
Then please add this line to your Proguard config file(proguard-rules.pro) and check it once
-keep class androidx.appcompat.widget.** { *; }
and also remove tools:replace="android:appComponentFactory" from manifest file
which is outside of <application> tag
Recently this problem become very common when using android support library and third party libraries. Try migrating to androidX, it's pretty safe. And add:
android.useAndroidX=true
android.enableJetifier=true
in your gradle.properties which will automatically done if you migrate to androidX with android studio 3.2 plugin, to do this, go to refactor menu and choose migrate to androidX.
Related
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 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.
I am working with an android project and every time I run the app there is an error of this type :
Manifest merger failed : Attribute application#appComponentFactory
value=(android.support.v4.app.CoreComponentFactory) from
[com.android.support:support-compat:28.0.0]
AndroidManifest.xml:22:18-91 is also present at
[androidx.core:core:1.0.0-alpha1] AndroidManifest.xml:22:18-86
value=(androidx.core.app.CoreComponentFactory). Suggestion: add
'tools:replace="android:appComponentFactory"' to element
at AndroidManifest.xml:10:5-44:19 to override.
And even if I try to do it the way it told me there is another error.
This is the build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.community.jboss.visitingcard"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
buildToolsVersion '28.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
//the intro library
implementation 'com.github.msayan:tutorial-view:v1.0.6'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation "com.android.support:preference-v7:28.0.0"
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
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'
}
And this is the Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.community.jboss.visitingcard">
<!--
TODO: Add location/GPS access permissions
TODO: Change the Label of the Activities according to the Activity's
context
TODO: Change App Icon .i.e., ic_launcher
-->
<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=".LoginActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar" />
<activity android:name=".VisitingCard.VisitingCardActivity" />
<activity android:name=".IntroScreens.SliderActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- TODO: Add Google Maps API key here -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".Maps.MapsActivity"
android:label="#string/title_activity_maps"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" />
<activity android:name=".VisitingCard.ViewVisitingCard" />
<activity
android:name=".SettingsActivity"
android:label="#string/title_activity_settings" />
<activity android:name=".IntroActivity"></activity>
</application>
</manifest>
Add the following line in your manifest :
tools:replace="android:appComponentFactory"
Like this :
<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"
tools:replace="android:appComponentFactory>
//Your code here
</application>
You are using two appcompat dependencies one from support namespace and another one is from androidx namespace.Ideally solution would be move your project completely to androidx and remove the below mentioned dependency,
implementation 'com.android.support:appcompat-v7:28.0.0'
and you could use stable version of andoid x appcompat library
androidx.appcompat:appcompat:1.0.0 instead of androidx.appcompat:appcompat:1.0.0-alpha1'
It seems you decided to use androidX in your project, but using appCompat with androidX together is incorrect.
It's better if you use androidX's libraries, remove appCompat ones.
If you insistent to use androidX remove implementation 'com.android.support:appcompat-v7:28.0.0' in build.gradle file or remove androidX one, otherwise.
for more information about your error :
You can open the "Manifest" file and go to merged tab. At the bottom of file you can see what are wrong.
I am trying to use Firebase crash reporting and notifications on an Android Project I inherited from my predecessor in my place of work.
For some unknown reason Firebase or OneSignal has refused to work on the project,it doesn't matter whether the app is in background or not. I implemented Firebase using the Android Studio Assistant.
However if I create fresh projects and implement Firebase or OneSignal it works glitchlessly.
Module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.myfirm.appname"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.facebook.android:facebook-android-sdk:4.20.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.joanzapata.pdfview:android-pdfview:1.0.4#aar'
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:customtabs:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.onesignal:OneSignal:3.4.3'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Project build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
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.myfirm.appname">
<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" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:name=".App"
android:allowBackup="true"
android:icon="#drawable/notification_icon"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:node="replace">
<service
android:name=".services.TokenService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<meta-data android:name="onesignal_app_id" android:value="#string/onesignal_app_id" tools:replace="android:value"/>
<meta-data android:name="onesignal_google_project_number" android:value="#string/onesignal_google_project_number" tools:replace="android:value"/>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_appid" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<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="fbXXXXXXXXXXXX" />
</intent-filter>
</activity>
// More Activities
</application>
</manifest>
MyApplication
#Override
public void onCreate() {
super.onCreate();
OneSignal.setLogLevel(OneSignal.LOG_LEVEL.DEBUG, OneSignal.LOG_LEVEL.NONE);
FirebaseApp.initializeApp(this);
// Removed some code
OneSignal.startInit(this)
.setNotificationReceivedHandler(new OneSignalMessageReceiver())
.init();
}
A few things to note:
The app is always in background (I launched it and pressed the home button) when I send the notifications.
On the dashboards (both Firebase and OneSignal), the message says it's been successfully sent.
I'm getting the device token on Firebase and I uses it to send notifications. Sometimes it says notification has been sent and at other times it says token not registered.
The reason why it appears I'm using both Firebase and OneSignal is because I tried Firebase first, it didn't work. Then I used OneSignal hoping hat it would Work but it didn't. So if any one works, I remove the other.
The google-services.json exists in ProjectName > app and yes, the package name correspond with that in manifest.
The crash reports are not showing on Firebase dashboard even when the app has crashed severally.
I am stuck on the last step trying to migrate my android app to heroku. In my android app I need to initialize my parse server by using a Parse.Configuration.Builder, but 'Configuration' is in red and I cannot figure out how to resolve the issue.
I have been referencing the parse server on github here:
https://github.com/ParsePlatform/parse-server-example
it gives this boilerplate code for initializing your android app to use heroku:
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext()).applicationId("myAppId").clientKey("myClientKey").server("http://myServerUrl/parse/").build());
When I create a new project I do not get the error, but I have checked the build files and manifest against the old project and cannot figure out what the hold up could be.
Here is my application class:
package oneonanyone.com.fantasybasketball_1onany1;
import com.parse.Parse;
public class StatSelectApplication extends android.app.Application {
#Override
public void onCreate() {
super.onCreate();
//Parse.enableLocalDatastore(this);
//Parse.initialize(this, "xxxxx", "xxxxx");
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId("xxxxx")
.clientKey("xxxxx")
.server("http://xxxxx.herokuapp.com/parse/")
.build());
}
}
build.grade
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "oneonanyone.com.fantasybasketball_1onany1"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}
repositories {
jcenter()
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.parse.bolts:bolts-tasks:1.3.0'
compile 'com.parse:parse-android:1.13.0'
compile fileTree('libs')
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.commonsware.cwac:wakeful:1.0.+'
}
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="oneonanyone.com.fantasybasketball_1onany1">
<uses-sdk/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.SET_DEBUG_APP"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<!--
To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
option is required to comply with the Google+ Sign-In developer policies
-->
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<!-- To retrieve the account name (email) as part of sign-in: -->
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<application
android:name=".StatSelectApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launch"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".DraftListActivity"
android:label="PlayerListActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>
<activity
android:name=".MainActivity"
android:label="Darkhorse"
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=".MatchUpActivity"
android:label="#string/title_activity_matchup"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
<activity
android:name=".MatchUpResultsActivity"
android:label="#string/title_activity_game_results"
android:screenOrientation="portrait"/>
<activity
android:name=".Login.LoginActivity"
android:label="#string/title_activity_login"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|stateHidden"/>
<activity
android:name=".Login.SignUpAtivity"
android:label="#string/title_activity_sign_up_ativity"
android:screenOrientation="portrait"/>
<activity
android:name=".ResultsActivityNew"
android:label="#string/title_activity_new_results"
android:screenOrientation="portrait"/>
<activity
android:name=".LeaderBoardActivity"
android:label="#string/title_activity_leader_board"
android:screenOrientation="portrait"/>
<activity
android:name=".AlternateDraftActivity"
android:label="#string/title_activity_alternate_draft"/>
<receiver android:name=".UpdateBackend">
<intent-filter>
<action android:name="android.net.ConnectivityManager.CONNECTIVITY_ACTION"/>
</intent-filter>
</receiver>
</application>
And my project gradle just in case:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
task clean(type: Delete) {
delete rootProject.buildDir
}
}
I could not find anyone else having this error. Any solution would be most appreciated.
Check answer here: connecting android to local parse server cannot resolve symbol Configuration
I had the Parse library as a jar in the libs folder. Solved the issue by deleting it and compiling from Gradle instead.