Ошибка Android Studio Не удалось найти метод android () для аргументов в проекте модуля - PullRequest
0 голосов
/ 01 февраля 2019

Попытка добавить обмен сообщениями SendBird в существующее приложение в Android.

Я импортировал SendBird (https://github.com/smilefam/SendBird-Android) как модуль в рабочий проект приложения Android в Android Studio.

Получениеэта ошибка синхронизации сборки:

Не удалось найти метод android () для аргументов [build_cmuu8gl1t8ajvfzi59kru30vs $ _run_closure1 @ 20899a01] в проекте ': SendBird' типа org.gradle.api.Project.

Эта ошибка указывает на файл SendBird build.gradle в качестве проблемы.Я включил файлы проекта и модулей build.gradle ниже.

Проект: VitalConcern8 build.gradle

    buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.2.0'

        classpath project(':SendBird')

        classpath project(':app')


    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Модуль: приложение build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.church.george.vitalconcern"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 2
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'org.apache.commons:commons-text: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.android.volley:volley:1.1.0'

}

Модуль: SendBird build.gradle

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.sendbird.android.sample"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode getVersionCode()
        versionName getVersionName()
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }

}


repositories {
    maven { url "https://raw.githubusercontent.com/smilefam/SendBird-SDK-Android/master/" }
    google()
}

dependencies {


    implementation fileTree(include: ['*.jar'], dir: 'libs')



    // Required for local unit tests (JUnit 4 framework)
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    // SendBird
    implementation 'com.sendbird.sdk:sendbird-android-sdk:3.0.88'

    // Android support libraries
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    // Firebase
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'

    // External libraries
    implementation 'com.github.bumptech.glide:glide:4.3.1'
    implementation 'org.jsoup:jsoup:1.11.2'
    implementation 'com.dinuscxj:circleprogressbar:1.1.1'
    implementation 'com.github.stfalcon:multiimageview:0.1'
}
apply plugin: 'com.google.gms.google-services'

apply plugin: 'com.android.library'
apply plugin: 'com.android.application'

1 Ответ

0 голосов
/ 01 февраля 2019

Это потому, что в вашем SendBird build.gradle есть следующий код:

apply plugin: 'com.android.library'
apply plugin: 'com.android.application'

Вам нужно только следующее:

apply plugin: 'com.android.library'

не забудьте переместитьэто как первая строка вашего SendBird build.gradle.И вам также нужно удалить это из него:

    applicationId "com.sendbird.android.sample"

, потому что у вас не может быть applicationId для модуля библиотеки.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...