gradle-mvn-push icon indicating copy to clipboard operation
gradle-mvn-push copied to clipboard

Fix for weird "package android.app does not exist" and "cannot find symbol" error messages.

Open paulpv opened this issue 10 years ago • 14 comments

This is semi-blessed by Xavier Ducrohet himself and thus semi-official: https://groups.google.com/forum/#!searchin/adt-dev/javadoc/adt-dev/seRizEn8ICA/bafEvUl6mzsJ

paulpv avatar Feb 11 '14 03:02 paulpv

I'm not sure that I'm super happy putting in something that relies on private APIs. Only way I think this would fly is if this script is versioned (via tags) to mirror the android plugin so we can depend on specific versions to ensure current and future correct behavior.

JakeWharton avatar Feb 11 '14 07:02 JakeWharton

Here's how it works in my build scripts without using private API.

task javadocs(type: Javadoc) {
  source = android.sourceSets.main.allJava
}
afterEvaluate {
  javadocs.classpath += files(android.plugin.runtimeJarList)
}

roman-mazur avatar Feb 11 '14 07:02 roman-mazur

Yeah that's how I grab it too. You sure that's not a private API? I can't remember anymore. On Feb 10, 2014 11:56 PM, "Roman Mazur" [email protected] wrote:

Here's how it works in my build scripts without using private API.

task javadocs(type: Javadoc) { source = android.sourceSets.main.allJava}afterEvaluate { javadocs.classpath += files(android.plugin.runtimeJarList)}

Reply to this email directly or view it on GitHubhttps://github.com/chrisbanes/gradle-mvn-push/pull/13#issuecomment-34732942 .

JakeWharton avatar Feb 11 '14 07:02 JakeWharton

Well perhaps I'm too confident calling this public API :) Yet getRuntimeJarList has an explicit public modifier, it might mean something and might not. Another question is whether android.plugin can be called a public API...

roman-mazur avatar Feb 11 '14 08:02 roman-mazur

I was mostly posting this Pull Request to get the conversation going. I realize, and lightly admitted, that the contribution isn't ideal. I'm fine w/ any solution, but without some sort of contribution, my project is unable to use gradle-mvn-push.gradle. I found it very odd that my fairly simple library project wouldn't compile, but there seemed to be no one else complaining that this script doesn't work on their library project.

Is the javadoc task required? Could there be a switch/option to not do it?

paulpv avatar Feb 11 '14 08:02 paulpv

It is required. Sonatype will not let you promote a repository to central without javadoc jars.

It should only fail to compile if you are using Java 8 due to the strict doclet. I've just been switching to Java 7 when invoking. On Feb 11, 2014 12:17 AM, "Paul Peavyhouse" [email protected] wrote:

I was mostly posting this Pull Request to get the conversation going. I realize, and lightly admitted, that the contribution isn't ideal. I'm fine w/ any solution, but without some sort of contribution, my project is unable to use gradle-mvn-push.gradle. I found it very odd that my fairly simple library project wouldn't compile, but there seemed to be no one else complaining that this script doesn't work on their library project.

Is the javadoc task required? Could there be a switch/option to not do it?

Reply to this email directly or view it on GitHubhttps://github.com/chrisbanes/gradle-mvn-push/pull/13#issuecomment-34733923 .

JakeWharton avatar Feb 11 '14 08:02 JakeWharton

Actually javadoc artifact is a Maven Central requirement for jars. I remember I managed to successfully publish aars without javadocs.

On 11 February 2014 10:17, Paul Peavyhouse [email protected] wrote:

I was mostly posting this Pull Request to get the conversation going. I realize, and lightly admitted, that the contribution isn't ideal. I'm fine w/ any solution, but without some sort of contribution, my project is unable to use gradle-mvn-push.gradle. I found it very odd that my fairly simple library project wouldn't compile, but there seemed to be no one else complaining that this script doesn't work on their library project.

Is the javadoc task required? Could there be a switch/option to not do it?

Reply to this email directly or view it on GitHubhttps://github.com/chrisbanes/gradle-mvn-push/pull/13#issuecomment-34733923 .

Best regards, Roman Mazur

Software engineer at Stanfy (http://stanfy.com.ua) Skype: roman.mazur.f LinkedIn: http://ua.linkedin.com/in/romanmazur Twitter: http://twitter.com/roman_mazur

roman-mazur avatar Feb 11 '14 08:02 roman-mazur

Do you suspect it is an oversight that it isn't required for aars and that they will eventually make it required?

paulpv avatar Feb 11 '14 08:02 paulpv

I believe so. AAR format is still very young. But after releasing 1.0 version of the plugin javadocs might become required for this packaging type. It seems to be rather plausible.

On 11 February 2014 10:27, Paul Peavyhouse [email protected] wrote:

Do you suspect it is an oversight that it isn't required for aars and that they will eventually make it required?

Reply to this email directly or view it on GitHubhttps://github.com/chrisbanes/gradle-mvn-push/pull/13#issuecomment-34734447 .

Best regards, Roman Mazur

Software engineer at Stanfy (http://stanfy.com.ua) Skype: roman.mazur.f LinkedIn: http://ua.linkedin.com/in/romanmazur Twitter: http://twitter.com/roman_mazur

roman-mazur avatar Feb 11 '14 08:02 roman-mazur

This seems to choke on external dependencies.

tyvsmith avatar Apr 17 '14 00:04 tyvsmith

Adding the following statement makes the build successful for me when the library has any external dependencies.

afterEvaluate {
    androidJavadocs.classpath += project.files(android.plugin.getRuntimeJarList().join(File.pathSeparator))
    // add this statement
    androidJavadocs.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath
}

But I'm new to gradle build script, so I don't know this is a proper way to resolve the problem.

KeithYokoma avatar Apr 17 '14 02:04 KeithYokoma

i have this problem for android.os when i wanted to use android.os.Parcelable ,gave me this error

yeganehaym avatar Jul 26 '16 07:07 yeganehaym

@paulpv @JakeWharton @roman-mazur @tyvsmith @KeithYokoma @yeganehaym your commits merged to https://github.com/Vorlonsoft/GradleMavenPush

AlexanderLS avatar Jul 19 '18 14:07 AlexanderLS

For me after updating the the below shown pic for me it worked

image

achakra21 avatar Sep 21 '23 07:09 achakra21