MainActivity error while importing package: `react-native-google-vr-panorama` - react-native

I am getting an error when I import a package into my JS file:
import GoogleVRPanorama, { PanoramaView } from 'react-native-google-vr-panorama'
Error:
This error I get with all the VR 360 components I try to import.
Edit-1:
I did follow the installation steps but I didn't rebuild the app
MainApplication.java: MainApplication
So when I rebuild the app, getting the following error:
C:\Users\cherry\Test03\node_modules\react-native-google-vr-panorama\android\src\main\java\com\xebia\googlevrpanorama\RNGoogleVRPanoramaPackage.java:14:
error: method does not override or implement a method from a supertype
#Override
^ Note: C:\Users\cherry\Test03\node_modules\react-native-google-vr-panorama\android\src\main\java\com\xebia\googlevrpanorama\RNGoogleVRPanoramaView.java
uses unchecked or unsafe operations. Note: Recompile with
-Xlint:unchecked for details. 1 error :react-native-google-vr-panorama:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':react-native-google-vr-panorama:compileReleaseJavaWithJavac'.
Compilation failed; see the compiler error output for details.

Sounds like you either
1. Did not finish the install steps, i.e. adding lines to MainApplication etc., see https://github.com/XebiaStudio/react-native-google-vr-panorama/blob/master/README.md#installation for details
or
2. Did not rebuild the app with react-native run-android.

Related

Execution failed for task ':react-native-reanimated:compileReleaseJavaWithJavac'. - Android Pipeline Build failed

I tried to build the app using the GitLab pipeline and it failed with the following error.
.../node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java:13: error: cannot find symbol
ViewManagerResolver viewManagerResolver,
^
symbol: class ViewManagerResolver
location: class ReanimatedUIImplementation
.../volcano/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java:11: error: recursive constructor invocation
public ReanimatedUIImplementation(
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native reanimated:compileReleaseJavaWithJavac'.
Note: VM and local machine configuration are same.

React Native Error: react-native-sensor-manager:compileDebugJavaWithJavac FAILED

I'm trying to use the react-native-sensor-manager in order to get the user steps and count that. But the problem is after I installed this package and did all the configuration as in the documentation. I don't know what is wrong although a did all the steps correctly. I get this error when I run my project. So the build doesn't become compeleted and project is running.
Here is more about the error:
Task :react-native-sensor-manager:compileDebugJavaWithJavac FAILED
E:\Project\React Native Projects\walk_tacker2\node_modules\react-native-sensor-manager\android\src\main\java\com\sensormanager\AccelerometerRecord.java:9: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
* What went wrong:
Execution failed for task ':react-native-sensor-manager:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Gradle annotation processor order (Android)

I'm writing a library based on code generation.
This library generating dagger's module via annotations. How do I run my annotation processor before dagger's code generation?
Now it crashes on build because dagger trying to build the component before modules was generated.
Error:
.ktC:\Users\syncended\AndroidStudioProjects\Daggerblade\app\build\tmp\kapt3\stubs\debug\dev\syncended\daggerblade\AppComponent.java:6: error: cannot find symbol
#dagger.Component(modules = {BookModule.class})
^
symbol: class BookModuleC:\Users\syncended\AndroidStudioProjects\Daggerblade\app\build\tmp\kapt3\stubs\debug\dev\syncended\daggerblade\AppComponent.java:7: error: [ComponentProcessor:MiscError] dagger.internal.codegen.ComponentProcessor was unable to process this interface because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.
public abstract interface AppComponent {
^Attempt to reopen a file for path C:\Users\syncended\AndroidStudioProjects\Daggerblade\app\build\generated\source\kapt\debug\dev\syncended\blade\BookModule.kt
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
> java.lang.reflect.InvocationTargetException (no error message)
* Try:

react native background Geolocation compile time error

I am using react-native-background-geolocation package. I am getting an error in gradle file
react-native-mauron85-background-geolocation:compileReleaseJavaWithJavac
Full recompilation is required because at least one of the classes of removed jar 'classes.jar' requires it. Analysis took 0.033 secs.
/home/ubuntu/code/truck-kothay-apps/truck-driver-app/node_modules/react-native-mauron85-background-geolocation/android/lib/src/main/java/com/marianhello/bgloc/data/BackgroundActivity.java:22:
error: cannot access AbstractSafeParcelable
confidence = actitivy.getConfidence();
^
class file for com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable
not found
Note: /home/ubuntu/code/truck-kothay-apps/truck-driver-app/node_modules/react-native-mauron85-background-geolocation/android/lib/src/main/java/com/marianhello/bgloc/BackgroundGeolocationFacade.java
uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:react-native-mauron85-background-geolocation:compileReleaseJavaWithJavac
FAILED
FAILURE: Build failed with an exception.
You need to check MainApplication.java file, check if
new BackgroundGeolocationPackage()
is there.
After that make these changes in app/build.gradle
compileSdkVersion 25
buildToolsVersion "25.0.2"
compile(project(':react-native-mauron85-background-geolocation')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
compile 'com.google.android.gms:play-services-base:+'
compile 'com.google.android.gms:play-services-maps:+'
Rebuild the project after that and see.

Grails cant use Spock framework?

I am currently working on a project that had started with no TDD in place and now I have taken the following steps to start using Spock for Unit and Integration testing on this project:
Added the following to the buildconfig:
test ":spock:0.7"
Then created a spec at "test/unit/MYCLASSNAME" called MyfunctionControllerSpec as shown below:
import grails.test.mixin.*
import spock.lang.Specification
class MyfunctionControllerSpec extends Specification {
void "list() should return no results with no records in DB"() {
given:
def model = controller.list()
expect:
model.taskInstanceList.size() == 0
model.taskInstanceTotal == 0
}
}
However I am getting the following errors with the Specification import line:
Groovy:unable to resolve class spock.lang.Specification
I don’t understand what I am doing wrong, have I imported or install Spock wrong?
Thanks in advance
EDIT*
I have tried the suggestion below and then the solution wont run and it still doesnt recognise the Specification class, even when I start typing "inport spo" and press cntrl+space nothing comes up as if it cant even recogise the plugin either:
Loading Grails 2.1.0
| Configuring classpath
| Downloading: spock-grails-support-0.7-groovy-2.0.pom.sha1
| Downloading: spock-core-0.7-groovy-2.0.pom.sha1
| Downloading: spock-grails-support-0.7-groovy-2.0.jar.sha1
| Downloading: spock-core-0.7-groovy-2.0.jar.sha1.
| Environment set to development....
| Error Error loading event script from file [/media/system/workspace/sms_bskyb_New_V2(Dynam Messages)/plugins/tool-ui/scripts/_Events.groovy] startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/home/system/.grails/ivy-cache/org.spockframework/spock-core/jars/spock-core-0.7-groovy-2.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception java.lang.reflect.InvocationTargetException
1 error
(Use --stacktrace to see the full trace)
| Error Error loading event script from file [/home/system/.grails/2.1.0/projects/sms_bskyb/plugins/database-migration-1.1/scripts/_Events.groovy] startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/home/system/.grails/ivy-cache/org.spockframework/spock-core/jars/spock-core-0.7-groovy-2.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception java.lang.reflect.InvocationTargetException
1 error
(Use --stacktrace to see the full trace)
| Error Error loading event script from file [/home/system/.grails/2.1.0/projects/sms_bskyb/plugins/tomcat-2.1.0/scripts/_Events.groovy] startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/home/system/.grails/ivy-cache/org.spockframework/spock-core/jars/spock-core-0.7-groovy-2.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception java.lang.reflect.InvocationTargetException
1 error
(Use --stacktrace to see the full trace)
| Error Error loading event script from file [/home/system/.grails/2.1.0/projects/sms_bskyb/plugins/spock-0.7/scripts/_Events.groovy] startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/home/system/.grails/ivy-cache/org.spockframework/spock-core/jars/spock-core-0.7-groovy-2.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception java.lang.reflect.InvocationTargetException
1 error
(Use --stacktrace to see the full trace)
| Error Error loading event script from file [/home/system/.grails/2.1.0/projects/sms_bskyb/plugins/webxml-1.4.1/scripts/_Events.groovy] startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/home/system/.grails/ivy-cache/org.spockframework/spock-core/jars/spock-core-0.7-groovy-2.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception java.lang.reflect.InvocationTargetException
1 error
(Use --stacktrace to see the full trace)
| Environment set to development.....
| Packaging Grails application.
| Error Fatal error during compilation org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/home/system/.grails/ivy-cache/org.spockframework/spock-core/jars/spock-core-0.7-groovy-2.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception java.lang.reflect.InvocationTargetException
1 error
(Use --stacktrace to see the full trace)
You are using Grails 2.1.0 whereas Groovy 2.0 was introduced in Grails 2.2.0 and above. Hopefully you do not need to explicit dependency org.spockframework:spock-grails-support:0.7-groovy-2.0. Only use as below:
plugins{
test ":spock:0.7"
}
In case you still find an issue then isolate the problem by creating a fresh new bare bone grails app and install the plugin as mentioned in the plugin docs. Try to see if there is any classpath clash. If the problem still exists, then clear ivy-cache and/or .m2 and retry.
I almost answered this here, but I see that you are using Grails 2.1.
For others that are getting this error with Grails 2.2.x see this answer