Reputation: 59
i have opened a project already created. I am adding firebase and onesignal. Already added firebase but when i try to add this line getting error:
implementation 'com.onesignal:OneSignal:3.7.1'
Error is: AAPT2 error: check logs for details
images may not be displayed, sorry about that.
build.gradle (module:app) :
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "dedeler.com.deredere"
minSdkVersion 17
targetSdkVersion 24
versionCode 11
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
onesignal_app_id : '82f1gtd7-uy16-4c37-80s4-b1ebd8ad38a6',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: '837758431119'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/ftp4j-1.7.2.jar')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.code-troopers.betterpickers:library:3.0.1'
compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'me.dm7.barcodescanner:zbar:1.9'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.firebase:firebase-messaging:17.1.0'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.android.gms:play-services-gcm:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.onesignal:OneSignal:3.7.1'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (project) :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:4.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
When i delete implementation 'com.onesignal:OneSignal:3.7.1'
this line project normally running, I am not getting an error. What should i do? need help..
Upvotes: 0
Views: 7090
Reputation: 161
Just Go to Your build.gradle (android/app).
And remove the `
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
And re-run project and error will be resolved.`
Upvotes: 0
Reputation: 147
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'
i have solved by adding this classpath dependency and later change it
Upvotes: 0
Reputation: 41
Include this code in your App/build.gradle
implementation 'com.onesignal:OneSignal:3.9.1'
Upvotes: 0
Reputation: 59
This build.gradle from doesn't work on Onesignal (and no error)
apply plugin: 'com.android.application'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "dedeler.com.dedede"
minSdkVersion 17
targetSdkVersion 24
versionCode 11
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
onesignal_app_id : '18u4a466-37t1-4f9n-bacd-cac2ed8f9c3c',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: '357658431414'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/ftp4j-1.7.2.jar')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.code-troopers.betterpickers:library:3.0.1'
compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'me.dm7.barcodescanner:zbar:1.9'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.firebase:firebase-messaging:17.1.0'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.onesignal:OneSignal:3.+@aar'
implementation 'com.google.android.gms:play-services-gcm:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
}
apply plugin: 'com.google.gms.google-services'
This build.gradle from normally working on Onesignal:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.berkancalikoglu.onesignalpushdemotutorial"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
onesignal_app_id : '9a39e119-d312-4517-a145-ea00482fa037',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: '260945562180'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-messaging:12.0.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'
implementation 'com.onesignal:OneSignal:3.9.2'
implementation 'com.google.android.gms:play-services-gcm:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
}
apply plugin: 'com.google.gms.google-services'
Why does Onesignal work one and not the other?
Upvotes: 1
Reputation: 11245
You need to add plugin
for that inside build.gradle like below.
buildscript {
repositories {
jcenter()
google()
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:4.0.0'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.11.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And inside app level build.gradle add this.
Apply plugin at top.
apply plugin: 'com.android.application'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
Inside Dependencies.
implementation 'com.onesignal:OneSignal:3.9.1'
Upvotes: 2