Как исправить ошибку «пакет okhttp3 не существует» произошла для моей библиотеки gradle - PullRequest
0 голосов
/ 07 ноября 2019

Недавно я пытаюсь обновить мою библиотеку Gradle, в которой есть зависимости retrofit2. Я загрузил все необходимые файлы на bintray, выполнив следующие команды:

"gradle install"

"gradle bintrayUpload"

Но я не получаю зависимостей retrofit2при попытке использовать зависимость bintray gradle в любом проекте.

Когда я проверил сгенерированный файл .pom, в нем не было тега "dependency", поэтому я вручную добавил зависимость и загрузил ее на bintray. репозиторий, но он не работал для меня.

Вот мой обновленный (вручную) файл pom:

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>GROUP_ID</groupId>
<artifactId>ARTIFACT_ID</artifactId>
<version>VERSION</version>
<packaging>aar</packaging>
<name>BINTRAY_NAME</name>
<description>LIBRARY_DESCRIPTION</description>
<url>LIBRARY_URL</url>
<licenses>
<license>
<name>LICENSE_NAME</name>
<url>LICENSE_URL</url>
</license>
</licenses>
<developers>
<developer>
<id>DEVELOPER_ID</id>
<name>DEVELOPER_NAME</name>
<email>DEVELOPER_EMAIL</email>
</developer>
</developers>
<scm>
<connection>CONNECTION_URL</connection>
<developerConnection>DEVELOPER_CONNECTION_URL</developerConnection>
<url>URL</url>
</scm>
<dependencies>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>2.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId>
<version>2.4.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

Зависимости SDK Gradle:

dependencies {
    ...
    ...

    //Retrofit2 
    api 'com.squareup.retrofit2:retrofit:2.4.0'
    api 'com.squareup.retrofit2:converter-gson:2.4.0'
    api 'com.google.code.gson:gson:2.8.5'

}

Демонстрационный проектЗависимости Gradle:

dependencies {
    ...
    ...

    //Bintray Gradle Dependency
    implementation 'group-id:artifact-id:version'

    //For proper working of Bintray Gradle, need to implement retrofit2 
    //which is already included in SDK Gradle
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...