gpt4 book ai didi

android - 尝试使用 'com.onesignal:OneSignal:3.7.1'但出现错误

转载 作者:行者123 更新时间:2023-12-03 04:59:06 25 4
gpt4 key购买 nike

我已经打开了一个已经创建的项目。我正在添加Firebase和onesignal。已经添加了firebase,但是当我尝试添加此行时出现错误:
implementation 'com.onesignal:OneSignal:3.7.1' 错误是:AAPT2 error: check logs for details

图像可能无法显示,对此感到抱歉。

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(项目):
// 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
}

当我删除 implementation 'com.onesignal:OneSignal:3.7.1'此行项目正常运行时,我没有收到错误。我该怎么办?需要帮忙..

最佳答案

您需要在build.gradle中添加plugin,如下所示。

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
}

在应用程序级别build.gradle中添加此代码。

在顶部应用插件。
apply plugin: 'com.android.application'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

内部依赖项。
implementation 'com.onesignal:OneSignal:3.9.1'

关于android - 尝试使用 'com.onesignal:OneSignal:3.7.1'但出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51185073/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com