Build fail with (Google I/O Android App 2017) - android

Error log:
warning: [options] bootstrap class path not set in conjunction with -source 1.7
/Users/samuelyang/AndroidStudioProjects/iosched-master/server/build/generated-source/endpoints/java/com/google/samples/apps/iosched/rpc/cms/Cms.java:346:
error: method does not override or implement a method from a supertype
#override
^
How do i build it?
The Error is occurred a file named Cms.java, and the code snipe of Cms.java as below:
#Override
public Builder setBatchPath(String batchPath) {
return (Builder) super.setBatchPath(batchPath);
}
Every time i comment all these error code snipe and build the project, all these code will be auto-gen ,i don't know how to handle this...
Could anyone help me? thanks...
Download Google I/O 2017 Android App here

I had the same problem with other project.
Try to change google-api-client libraries from 1.22.0 to 1.23.0 in build.gradle
compile 'com.google.api-client:google-api-client:1.23.0'
compile 'com.google.http-client:google-http-client-android:1.23.0'

Related

Data binding with Kotlin: ProcessDataBinding Unable to get public no-arg constructor

I get this error when I type ./gradlew test in the command line:
e: java.util.ServiceConfigurationError: javax.annotation.processing.Processor: android.databinding.annotationprocessor.ProcessDataBinding Unable to get public no-arg constructor
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:581)
at ...
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 59 more
> Task :app:kaptDebugKotlin FAILED
FAILURE: Build failed with an exception.
It occurs also when I have kapt "androidx.databinding:databinding-compiler:$gradlePluginVersion" (both for 3.2.0 and 3.3.0-alpha13 versions) in build.gradle. I don't have other kapt dependencies. I have data binding enabled, it works and I can run tests via Android Studio (gradle task testDebugUnitTest works). I use embedded JDK.
I fixed this problem by using Java 8 instead of Java 11. The same problem may appear with Java 9 and 10. I set my JAVA_HOME via export JAVA_HOME=/path/to/java/8 and then ran ./gradlew build. And voila, no error.
I had the exception e: java.util.ServiceConfigurationError: javax.annotation.processing.Processor: android.databinding.annotationprocessor.ProcessDataBinding Unable to get public no-arg constructor and java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
when I ran the build from the command line using gradle. But these didn't appear when I run the build from Android Studio. I suspect this is because Android Studio is somehow using its own version of Java.
If you need to use databinding on Java 9+, you'll need to add JAX-B dependencies. Add this to your build.gradle's dependencies {} block:
// Add missing dependencies for JDK 9+
if (JavaVersion.current().ordinal() >= JavaVersion.VERSION_1_9.ordinal()) {
// Add both if you're using both Kotlin and Java
// If you're using Kotlin
kapt "com.sun.xml.bind:jaxb-core:2.3.0.1"
kapt "javax.xml.bind:jaxb-api:2.3.1"
kapt "com.sun.xml.bind:jaxb-impl:2.3.2"
// If you're using Java
annotationProcessor "com.sun.xml.bind:jaxb-core:2.3.0.1"
annotationProcessor "javax.xml.bind:jaxb-api:2.3.1"
}
Its because of Java version > 8
Point your JAVA_HOME to Java 8 version, it will work smoothly
Java 8 Download link
Details solution is here
java.util.ServiceConfigurationError: javax.annotation.processing.Processor: android.databinding.annotationprocessor.ProcessDataBinding Unable to get public no-arg constructor
I was getting this error because my 'build.gradle' , 'kotlin_version' and 'gradle wrapper' were not upto date.
ext.kotlin_version = '1.3.10' >> '1.3.20'
build:gradle:3.5.2 >> build:gradle:4.2.1
distributions/gradle-5.4.1-all.zip >> distributions/gradle-6.7.1-all.zip

React Native Android: Method does not override or implement a method from a supertype

I've added react-native-fbsdk to my react native project and have it building fine on iOS. But on the android side, I can't get gradle to build the project. When trying to compile react-native-fbsdk, I'm hitting: "method does not override or implement a method from a supertype"
21:41:11.863 [INFO] [org.gradle.api.internal.tasks.compile.JdkJavaCompiler] Compiling with JDK Java compiler API.
21:41:12.100 [ERROR] [system.err] /Users/joncursi/Sites/joncursi/redbirdNative/node_modules/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java:61: error: method does not override or implement a method from a supertype
Which points to the following code snippet within react-native-fbsdk:
#Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
When I delete #Override, this particular instance of the error goes away, but I hit the same error in another module such as react-native-image-picker:
:react-native-image-picker:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/Users/joncursi/Sites/joncursi/redbirdNative/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/ImagePickerPackage.java:34: error: method does not override or implement a method from a supertype
#Override
^
1 error
I suspect this to be an issue with my local setup. Any ideas on what could be wrong here?
The error is very vague (and imo a bit of a mess up in the react native release flow).
React-native 0.47.0 had a breaking change that meant libs had to patch their code.
Remove unused createJSModules calls (ce6fb33, 53d5504) - source
My guess is that you just have to update the libraries for which this error shows up, and otherwise submit a PR.
Here's an example of a lib fixing it: https://github.com/rebeccahughes/react-native-device-info/pull/191/files
Update:
The PR you're waiting for is here: https://github.com/facebook/react-native-fbsdk/pull/354

error: cannot find symbol method getColor(Context,int) after adding Sugar ORM to project

I would like to use SugarOrm in my app.
If I add the followings:
compile 'com.github.satyan:sugar:1.4'
to the gradle file
and
android:name="com.orm.SugarApp"
to my mainfest's application name
I get the following error on build:
Error:(75, 55) error: cannot find symbol method getColor(Context,int)
at this line:
holder.bg.setBackgroundColor(ContextCompat.getColor(ctx, R.color.primary_move));
If I checkout to a previous version without these 2 lines, my application builds and runds without error.
Any suggestions?
From the Android Documentation:
Helper for accessing features in Context introduced after API level 4
in a backwards compatible fashion.
Do you really need that backward compatibility? Try accesing getColor from the context. You can also still useContext.getColor() while you resolve the main issue however
I have updated to compile 'com.github.satyan:sugar:1.6' and error is gone.

Dagger 2 on Android, missing error messages

I'm using Dagger 2 in my Android project and I'm having trouble debugging it. I know that the compilation fails because of an error in my dagger 2 setup (had it before) but it's almost impossible to track it down because I don't get a proper error message telling me where the problem lies. All I get are messages that show that the annotation processing failed. Along the lines of:
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Error:(14, 28) error: cannot find symbol class BR
Error:(17, 40) error: package com.some.package.databinding does not exist
Error:(17, 51) error: cannot find symbol class DaggerSomeComponent
...
Maybe it's somehow related to the fact that I'm also using databinding!?
I'm using Dagger 2.5, Gradle plugin 2.1.2 and android-apt 1.8.
Thanks for your help!
Java
javac by default will only show up to 100 errors. You are probably over this limit because of databinding reporting an error for each binding class it generates.
Add this to your apps's build.gradle:
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "500"
}
}
Kotlin
You can enable the same javac option when using kapt by adding the following to your build.gradle.
kapt {
javacOptions {
option("-Xmaxerrs", 500)
}
}
This is currently ignored, but will be fixed in Kotlin v1.2.20.

How to fix error "could not find class 'com.github.OrangeGangsters.circularbarpager.library.CircularBar'

I'm trying to get Daniel Waldron's CircularBarPager working with Android Studio but unfortunately it won't work.
error:E/dalvikvm: Could not find class 'com.github.OrangeGangsters.circularbarpager.library.CircularBar', referenced from method com.github.OrangeGangsters.circularbarpager.library.CircularBarPager.initializeView
Error: Could not find comes when you are trying to run your Java
program using java command with the class is not able to find the
class.
You need to follow CircularBarPager Instructions .
Just add this to your build.gradle file
compile 'com.github.orangegangsters:library:1.3.4#aar'
Example
dependencies {
compile 'com.github.orangegangsters:library:1.3.4#aar'
}
Then Clean-Rebuild-Restart Your Project .Hope it will works .

Categories

Resources