Android Studio: преобразование зависимости GitHub в локальную зависимостьAndroid

Форум для тех, кто программирует под Android
Ответить
Гость
 Android Studio: преобразование зависимости GitHub в локальную зависимость

Сообщение Гость »


I am currently using the libraries from this repository in my application.
I want to make some changes to the library, so I downloaded the repository, imported the modules inside Android Studio, and updated the settings.gradle and build.gradle files to include the local modules and remove the remote ones.
However, when syncing my project I am getting warnings that all of the new modules failed to resolve. As a result, I cannot run my application.
Here is what I did in detail:
Before changing anything, my build.gradle file dependencies where as follows:

Код: Выделить всё

dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

implementation 'io.github.oneuiproject.sesl:appcompat:1.4.0'
implementation 'io.github.oneuiproject.sesl:coordinatorlayout:1.0.0'
implementation 'io.github.oneuiproject.sesl:drawerlayout:1.0.0'
implementation 'io.github.oneuiproject.sesl:preference:1.1.0'
implementation 'io.github.oneuiproject.sesl:recyclerview:1.4.1'
implementation 'io.github.oneuiproject.sesl:swiperefreshlayout:1.0.0'
implementation 'io.github.oneuiproject.sesl:viewpager:1.1.0'
implementation 'io.github.oneuiproject.sesl:viewpager2:1.1.0'

implementation 'io.github.oneuiproject.sesl:material:1.5.0'

implementation 'io.github.oneuiproject.sesl:apppickerview:1.0.0'
implementation 'io.github.oneuiproject.sesl:indexscroll:1.0.3'
implementation 'io.github.oneuiproject.sesl:picker-basic:1.2.0'
implementation 'io.github.oneuiproject.sesl:picker-color:1.1.0'

implementation 'io.github.oneuiproject:design:1.2.6'
}
I want to change the appcompat library, so I downloaded the entire repository and imported the appcompat module and the below as they are required by appcompat:
  • core
  • customview
  • drawerlayout
  • fragment
  • viewpager
Note that core, customview, and fragment are not in the above dependencies because they are local dependencies in the repository. I'm not sure how that works but I imagine that somehow they are included automatically.
I add the following to my settings.gradle:

Код: Выделить всё

include ':app'
include ':appcompat'
include ':core'
include ':drawerlayout'
include ':customview'
include ':fragment'
include ':viewpager'
And update my dependencies to the following:

Код: Выделить всё

dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

//    implementation 'io.github.oneuiproject.sesl:appcompat:1.4.0'
implementation 'io.github.oneuiproject.sesl:coordinatorlayout:1.0.0'
//    implementation 'io.github.oneuiproject.sesl:drawerlayout:1.0.0'
implementation 'io.github.oneuiproject.sesl:preference:1.1.0'
implementation 'io.github.oneuiproject.sesl:recyclerview:1.4.1'
implementation 'io.github.oneuiproject.sesl:swiperefreshlayout:1.0.0'
//    implementation 'io.github.oneuiproject.sesl:viewpager:1.1.0'
implementation 'io.github.oneuiproject.sesl:viewpager2:1.1.0'

implementation 'io.github.oneuiproject.sesl:material:1.5.0'

implementation 'io.github.oneuiproject.sesl:apppickerview:1.0.0'
implementation 'io.github.oneuiproject.sesl:indexscroll:1.0.3'
implementation 'io.github.oneuiproject.sesl:picker-basic:1.2.0'
implementation 'io.github.oneuiproject.sesl:picker-color:1.1.0'

implementation ':appcompat'
implementation ':core'
implementation ':drawerlayout'
implementation ':customview'
implementation ':fragment'
implementation ':viewpager'
}

For each module folder (appcompat, core, etc.), I do the following:
  • Add the manifest.gradle that is found in the root of the repository to the root of the module folder and add

    Код: Выделить всё

    apply from: 'manifest.gradle'
    to the build.gradle file in the root of the module folder. I did this because I was getting errors since the build.gradle file refers variables that are in manifest.gradle.
  • I was getting errors that a namespace must be declared in build.gradle. So for each build.gradle in the root of the module folder I added

    Код: Выделить всё

    namespace 'com.myapp'
    in the android block. Not sure if I used the correct package name here.
However, after doing this the modules are still not being found by Android Studio and I cannot run my application.


Источник: https://stackoverflow.com/questions/781 ... dependency
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

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

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»