Dokka 1.4.20 "Nothing to document" - android

Dokka 1.4.20 does not generate any documentation and returns the following for all tasks
> Task :dokkaJavadoc
Dokka 1.4.* is an alpha project
Initializing plugins
Validity check
Creating documentation models
Exiting Generation: Nothing to document
build.gradle (Project)
buildscript {
// omitted a bunch of versions here
ext.version_dokka = '1.4.20'//0.9.17//1.4.20
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath("org.jetbrains.dokka:dokka-gradle-plugin:$version_dokka")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id("org.jetbrains.dokka") version "$version_dokka"
}
allprojects {
repositories {
google()
jcenter()
}
// used for testing 0.9.17
// dokka {
// outputFormat = 'html'
// outputDirectory = "$buildDir/documentation "
//
// }
}
task clean(type: Delete) {
delete rootProject.buildDir
}
It does generate the folders when using 1.4.20, but both command-line running as well as running the tasks in the Gradle panel do not work.
The documentation also specifies a bunch of things for configuration, but it is very unclear, and half of it gives me additional errors like setting the output directory.
I have tried version 0.9.17 as well, but with no success.

Seems like you're missing the following in your module level build.gradle (here for version 1.4.20)
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlinx-serialization'
id 'org.jetbrains.dokka'
}
dokkaHtml {
dokkaSourceSets {
named("main") {
includeNonPublic.set(false)
skipEmptyPackages.set(true)
skipDeprecated.set(true)
reportUndocumented.set(true)
jdkVersion.set(8)
}
}
}
android {
compileSdkVersion 30
Just add the dokkaHtml task.
Keep in mind syntax has significantly change since version 1.x. In version prior to 1.4x you will have to use the following syntax
dokka {
outputFormat = 'html'
outputDirectory = "$buildDir/dokka/html"
configuration {
includeNonPublic = false
skipEmptyPackages = true
skipDeprecated = true
reportUndocumented = true
jdkVersion = 8
}
}

Related

How do I publish subproject to Maven with subprojects buildscript gradle version?

I want to publish some subproject to maven by using maven-publish plugin. The current Gradle script looks like this.
apply plugin: 'maven-publish'
group "com.huawei.quickapp"
version "1.0-SNAPSHOT"
publishing {
publications {
publishTask(MavenPublication) {
}
}
repositories {
maven {
url = uri("${rootDir}/local_repo/repos/")
}
}
}
}
static Boolean publishIfNeeded(taskName){
println("name = " + taskName)
def list = ["baselibrary", "corelibrary"]
if (taskName in list) {
return true
}
return false
}
I just want two libraries,core and base to be published. When I submitted the code to the pipeline, the CI suggested that the NDK version did not match, but there was no NDK-related configuration in my code. The upgrade is necessary because only versions greater than 3.6 support the use of From Components.Debug or some other build variable in gradle script.I tried configuring the build script for Subproject separately like this:
buildscript {
ext.kotlin_version = "1.4.21"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.5.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
subprojects {
buildscript {
ext.kotlin_version = "1.4.21"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
}
}
}
but it still not work. I got this error
Could not get unknown property 'Debug' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
Is there a way to publish a submodule using the buildScripte of a submodule? thx.

"Could not find appcompat-v7.aar" on Gradle build after running tns update

Summarize the problem
When did this start to happen?
I wanted to update ListPicker text-color value, so I followed these steps (more info):
Run sdkmanager --update;
Update Android SDK version in app.gradle;
Nuke node_modules;
Run npm install;
Run tns update;
Run tns platform remove android;
Run tns run android.
Error messages
Below is a summary of the build output.
Webpack compilation complete. Watching for file changes.
Webpack build done!
nativescript-plugin-firebase: building for same environment, not forcing prepare.
Project successfully prepared (android)
Configure firebase
Copy C:\Users\Hp\Documents\BitBucket\ayneh-mobile-app\app\App_Resources\Android\google-services.json to C:\Users\Hp\Documents\BitBucket\ayneh-mobile-app\platforms\android\app\google-services.json.
Building project...
Gradle build...
+ setting applicationId
+ applying user-defined configuration from C:\Users\Hp\Documents\BitBucket\ayneh-mobile-app\app\App_Resources\Android\app.gradle
Applying settings from C:\Users\Hp\Documents\BitBucket\ayneh-mobile-app\app\App_Resources\Android\settings.json
+ using android X library androidx.legacy:legacy-support-v4:1.0.0
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
[...]
Build file 'C:\Users\Hp\Documents\BitBucket\ayneh-mobile-app\platforms\android\app\build.gradle' line: 598
A problem occurred configuring project ':app'.
Could not find appcompat-v7.aar (androidx.appcompat:appcompat:1.1.0-alpha05).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/appcompat/appcompat/1.1.0-alpha05/appcompat-v7-1.1.0-alpha05.aar
Share some code
app/App_Resources/Android/app.gradle:
android {
defaultConfig {
minSdkVersion 26
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
def settingsGradlePath
if(project.hasProperty("appResourcesPath")){
settingsGradlePath = "$project.appResourcesPath/Android/settings.gradle";
} else {
settingsGradlePath = "$rootDir/../../app/App_Resources/Android/settings.gradle";
}
def settingsGradleFile = new File(settingsGradlePath);
if(settingsGradleFile.exists())
{
apply from: settingsGradleFile;
}
platforms/android/build.gradle:
buildscript {
def initialize = { ->
def userDir = "${rootProject.projectDir}/../.."
apply from: "$rootDir/gradle-helpers/user_properties_reader.gradle"
apply from: "$rootDir/gradle-helpers/paths.gradle"
rootProject.ext.userDefinedGradleProperties = getUserProperties("${getAppResourcesPath(userDir)}/Android")
}
initialize()
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "1.3.41"
}
def kotlinVersion = computeKotlinVersion()
repositories {
google()
mavenCentral()
jcenter()
maven { url "https://maven.fabric.io/public" }
maven { url "https://dl.bintray.com/android/android-tools" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "com.google.gms:google-services:4.3.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "io.fabric.tools:gradle:1.26.1"
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
beforeEvaluate { project ->
if (rootProject.hasProperty("userDefinedGradleProperties")) {
rootProject.ext.userDefinedGradleProperties.each { entry ->
def propertyName = entry.getKey()
def propertyValue = entry.getValue()
project.ext.set(propertyName, propertyValue)
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Describe what you've tried
Change SDK version in app.gradle.
Add mavenCentral() to buildscript's repositories in build.gradle.
Update Android Studio.
tns platform remove android

Could not find method kotlin() for arguments [gradle-plugin, 1.3.20]

I've copied exactly what the kotlin gradle docs say to implement kotlin gradle plugin, however it's returning the following error:
Could not find method kotlin() for arguments [gradle-plugin, 1.3.20] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
my gradle
buildscript {
ext.kotlin_version = '1.3.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath(kotlin("gradle-plugin", version = "1.3.20"))
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
// ext {
// navigationVersion = '28.0.0'
// }
plugins {
kotlin("<...>")
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Any idea?
build.gradle can be written in Groovy or Kotlin. You're typing your build.gradle in Groovy (not Kotlin), but you have copied the Kotlin code. You should select the Groovy tab on the documentation:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.3.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
}
}
Here: https://kotlinlang.org/docs/reference/using-gradle.html#targeting-android
You can also find a decent example by creating an empty Android and Kotlin project.

Gradle Sync failed:Could not find method compile() for arguments

i am refering this https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started to integrate mopub in my app. I got an error "could not find method compile for arguments" while adding mopub-sdk dependency in my project's build.gradle file.Please help me out.
Build.gradle file:
buildscript {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}}
allprojects {
repositories {
jcenter()
}
dependencies {
compile('com.mopub:mopub-sdk:4.14.0#aar') {
transitive = true
}
// For banners
compile('com.mopub:mopub-sdk-banner:4.14.0#aar') {
transitive = true
}
// For interstitials
compile('com.mopub:mopub-sdk-interstitial:4.14.0#aar') {
transitive = true
}
// For rewarded videos. This will automatically also include
interstitials
compile('com.mopub:mopub-sdk-rewardedvideo:4.14.0#aar') {
transitive = true
}
// For native static (images).
compile('com.mopub:mopub-sdk-native-static:4.14.0#aar') {
transitive = true
}
// For native video. This will automatically also include native static
compile('com.mopub:mopub-sdk-native-video:4.14.0#aar')
{transitive = true}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Actual Error:-
Error:(31, 0) Could not find method compile() for arguments [com.mopub:mopub-sdk:4.14.0#aar, build_7edkg2m28hxg79jomt8w3j8ic$_run_closure1$_closure4$_closure5#1c36532] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
You need to put your dependencies in the other build.gradle. They belong to the individual module build.gradle files.
Also, you are importing com.mopub:mopub-sdk:4.14.0#aar, which contains all of the ad format dependencies you already have below in your Gradle file. You only need com.mopub:mopub-sdk:4.14.0#aar or the modularized artifacts.

Gradle publish to the specific repo of the Artifactory

I am trying to setup the artifacts (APK/aar files) build process with gradle similar to how I am used to with maven.
mvn release:prepare (Adjusts version, checks into SVN, creates the tag)
mvn release:perform -Dgoals=deploy (Pushes the artifact to http://artifactory.XXX.local/artifactory/libs-releases-local/)
I want to be able to run the gradle commands and achieve similar results. I am using https://github.com/researchgate/gradle-release plugin for the release management (which works fine so I am good with release). But when I run the command gradlew artifactoryPublish the artifact is deployed at some other location (as if it's not respecting the repoKey in the gradle file)
D:\my-lib-android-0.0.2>gradlew artifactoryPublish ... ... [buildinfo]
Not using buildInfo properties file for this build.
:artifactoryPublish Deploying build descriptor to:
http://artifactory.XXX.local/artifactory/api/build Build successfully
deployed. Browse it in Artifactory under
http://artifactory.XXX.local/artifactory/webapp/builds/my-lib-android-0.0.2/1449880830949>
BUILD SUCCESSFUL
Total time: 9.692 secs
So my question is how can I fix my setup so that the artifact is pushed to a URL similar to this:
http://artifactory.XXX.local/artifactory/libs-releases-local/com/example/my-lib-android/0.0.2/my-lib-android-0.0.2.aar
build.gradle File:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.1.2')
classpath 'net.researchgate:gradle-release:2.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'net.researchgate.release' version '2.3.4'
}
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'
apply plugin: 'net.researchgate.release'
allprojects {
repositories {
jcenter()
maven {
url 'http://artifactory.XXX.local/artifactory/libs-releases-local'
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
//The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = "libs-releases-local"
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
release {
revertOnFail = false
}
task build{
}
gradle.properties File:
version=my-lib-android-0.0.3-SNAPSHOT
artifactory_user=myUserName
artifactory_password=myPasssword
artifactory_contextUrl=http://artifactory.XXX.local/artifactory
Using android-maven plugin:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.2'
classpath 'com.github.dcendents:android-maven-plugin:1.0'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.2.0'
}
}
apply plugin: 'android-library'
apply plugin: 'com.jfrog.artifactory-upload'
apply plugin: 'android-maven'
configurations {
published
}
task sourceJar(type: Jar) {
from android.sourceSets.main.java
classifier "sources"
}
artifactoryPublish {
dependsOn sourceJar
}
artifacts {
published sourceJar
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = "libs-releases-local"
username = "${artifactory_user}"
password = "${artifactory_password}"
}
defaults {
publishConfigs('archives', 'published')
publishPom = true //Publish generated POM files to Artifactory (true by default)
publishIvy = false //Publish generated Ivy descriptor files to Artifactory (true by default)
}
}
}
I usually do it with the mavenDeployer-plugin like this.
Don't know if it matches your case, but I'll just leave it here.
apply plugin: 'maven'
uploadArchives {
repositories {
mavenDeployer {
repository(url: 'http://arandom.nexus.com:8081/nexus/content/repositories/releases') {
authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD);
}
snapshotRepository(url: 'http://arandom.nexus.com:8081/nexus/content/repositories/snapshots') {
authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD);
}
pom.groupId = "groupId"
pom.artifactId = "artifactId"
pom.version = "${versionMajor}.${versionMinor}.${versionPatch}"
}
}
}
some further reading for local repos here

Categories

Resources