In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
In this article, the editor introduces in detail "Android Studio3.6.1 how to package jar", the content is detailed, the steps are clear, and the details are handled properly. I hope this "Android Studio3.6.1 how to package jar" article can help you solve your doubts. Let's follow the editor's ideas to learn new knowledge.
AndroidStudio package jar
Recently updated androidstudio found that packaged jar is no longer available.
Let's take a look at the previous method.
New usage after update
/ / Copy type Run gradlew makeJartask makeJar (type: Copy) in Terminal {/ / delete the existing delete 'build/libs/' + jarName + ".jar" / / set the copied file from ("build/intermediates/aar_main_jar/release") / / enter the file directory after the jar package Put classes.jar into the into ('build/libs/') / / jar file to be packaged include (' classes.jar') / / rename rename ('classes.jar', jarName + ".jar")} makeJar.dependsOn (build) under the build/libs/ directory
Complete usage
1. Add a sentence at the end of the build.gradle of lib project
Apply from: 'toJar.gradle'
two。 Create the file toJar.gradle in the build.gradle sibling directory
Enter 3.List item in toJar.gradle as follows:
Def jarName = "utils1.0" / / Copy type Run gradlew makeJartask makeJar (type: Copy) in Terminal {/ / delete the existing delete 'build/libs/' + jarName + ".jar" / / set the copied file from ("build/intermediates/aar_main_jar/release") / / enter the file directory after the jar package Put classes.jar into the into ('build/libs/') / / jar file to be packaged include (' classes.jar') / / rename rename ('classes.jar', jarName + ".jar")} makeJar.dependsOn (build) / /-encoding UTF-8-charset UTF-8tasks.withType (JavaCompile) {options.encoding = "UTF-8"} / / generate the sourcesJar of the jar package under the build/libs/ directory It doesn't need to be modified. Task sourcesJar (type: Jar) {from android.sourceSets.main.java.srcDirs classifier = 'sources' archiveName = jarName +'-sources.jar'} / / generates the task of jarDoc without modification. Task javadoc (type: Javadoc) {failOnError false source = android.sourceSets.main.java.srcDirs options.encoding = "UTF-8" classpath + = project.files (android.getBootClasspath () .join (File.pathSeparator)) classpath + = configurations.compile} / / generate the jar of javaDoc without modification. Task javadocJar (type: Jar, dependsOn: javadoc) {group = 'jar' classifier =' javadoc' from javadoc.destinationDir archiveName = jarName +'- javadoc.jar'} task generateJavadoc (type: Javadoc) {source = android.sourceSets.main.java.srcDirs ext.cp = android.libraryVariants.collect {variant-> variant.javaCompile.classpath.files} classpath = files (ext.cp)} artifacts {archives sourcesJar archives javadocJar}
4. Execute gradlew makeJar in Terminal
5. At this time, you will have your own jar package under the build/libs folder.
Read here, this "Android Studio3.6.1 how to package jar" article has been introduced, want to master the knowledge of this article also need to practice and use to understand, if you want to know more about the article, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.