我已经打开了一个已经创建的项目。我正在添加firebase和onesignal。已经添加了firebase,但是当我尝试添加这一行时得到错误:implementation 'com.onesignal:OneSignal:3.7.1'
错误为:AAPT2 error: check logs for details
- 图像可能无法显示 *,对此表示抱歉。
build.gradle(模块:应用程序):
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'
构建.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'
这行项目正常运行,我没有得到一个错误。我该怎么办?需要帮助。
5条答案
按热度按时间wribegjk1#
您需要在 build.gradle 内部添加
plugin
,如下所示。在应用级别 build.gradle 中添加此内容。
在顶部应用插件。
内部依赖项。
xxe27gdn2#
此版本的.gradle无法在Onesignal上运行(并且没有错误)
此build.gradle在Onesignal上正常工作:
为什么Onesignal只对其中一个起作用而对另一个不起作用?
dxpyg8gm3#
将此代码包含在您的App/build.gradle中
knsnq2tg4#
我已经通过添加这个类路径依赖解决了这个问题,以后再更改它
elcex8rz5#
1.只需转到您的build.gradle(安卓/应用程序)。
1.并删除'
应用插件:'com.onesignal. android软件包.onesignal-gradle插件'
1.然后重新运行项目,错误就会得到解决'