I’ve written before about the use of multiple Android Studio projects that rely on the same module, but there are a few issues with the use, slow compilation and always showing associated projects. So it was decided to manage the public aar module using Maven private server, which is documented here.

Nexus3 Download and installation

D:\nexus-3.20.1-01-win64\nexus-3.20.1-01\bin

nexus.exe /run
Copy the code

If you see Started Sonatype Nexus OSS 3.20.1-01, you can successfully open http://localhost:8081/ and enter the configuration screen

For details, see Maven Nexus 3.x server setup

There are many articles on the Internet. Here are some of the problems in the process of building.

Problems and solutions

1 unable to resolve dependency for:xxx

Configure and import private dependencies, but resolve cannot be resolved

Solution:

1. Nexus allows anonymous logins

The operation is violent

2. Configure the account password for reference dependency

Project build.gradle AllProjects -> Repositories configures the Maven URL with the user name and password

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            credentials {
                username 'username'
                password 'password'
            }
            url 'http://localhost:8081/repository/Android/'}}}Copy the code

2 The class. Jar in aar is empty

You can’t find the class in the AAR after successfully introducing the dependency

For details, see the solution to aar confusion after the package is empty, Android confusion explained

Solution:

The aar typed is a Release, so turn off confounding release, or the classes you want to expose

3 Error: encoding GBK non-mappable character

Error generating Java Doc: unmappable character encoding GBK

Build. Gradle in the Module

tasks.withType(Javadoc) {
    options.addStringOption('Xdoclint:none'.'-quiet')
    options.addStringOption('encoding'.'UTF-8')}Copy the code

4 Javadoc: error – invalid package name

Add it to dependencies under buildScript in the build.gradle file under Root Project:

classpath 'org. Jetbrains. Dokka: dokka - android - gradle - plugin: 0.9.17'
Copy the code

Module build.gradle application plugin

apply plugin: 'org.jetbrains.dokka-android'
Copy the code

For details, see using Gradle to package Kotlin project code and generate Kotlin code documentation

ReasonPhrase: Internal Privoxy Error is displayed during deploy.

> Failed to deploy artifacts: Could not transfer an artifact cn. Example. Baselib: library - base: aar: 0.0.1 the from/to remote (http://localhost:8081/repository/Android/): Failed to transfer file: http://localhost:8081/repository/Android/cn/example/baselib/library-base/0.0.1/library-base-0.0.1.aar. Return code is: 500, ReasonPhrase: Internal Privoxy Error.Copy the code

Solution: Close the Android Studio agent

Windows in C:\Users\Administrator\.gradle\gradle.properties file

## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Mon Jan 06 13:56:29 CST 2020Remove the agent# systemProp, HTTP proxyHost = 127.0.0.1
#systemProp.http.proxyPort=1080
Copy the code

Thank you

Android Studio publishes projects to Maven repositories (3 ways latest and most complete)

Continuous delivery and integration of Kotlin’s Nexus private repository with the Java hybrid project

Maven private Nexus 3.x server built

Fix aar confusion after the package is empty, android confusion explained

Use Gradle to package Kotlin project code and generate Kotlin code documentation

Build a private Maven repository (with DISASTER recovery backup)


About me


I am a Fly_with24

  • The Denver nuggets
  • Jane’s book
  • Github