I'm getting this error in Android Studio:
"Cannot access class 'org.tensorflow.lite.support.tensorbuffer.TensorBuffer'. Check your module classpath for missing or conflicting dependencies"
What is the problem ? and How can I fix it ?
Adding this worked for me instead:
implementation 'org.tensorflow:tensorflow-lite:+'
implementation 'org.tensorflow:tensorflow-lite-gpu:+'
implementation 'org.tensorflow:tensorflow-lite-support:+'
Please add the following item in the build.gradle:
dependencies {
...
implementation 'org.tensorflow:tensorflow-lite-support:0.1.0-rc1'
}
Related
Groovy version: 2.5.1
Java version: 10.0.2
Trying to launch the groovyConsole I get the following:
$ groovyConsole
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/usr/local/opt/groovy/libexec/lib/groovy-2.5.1.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:114)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:136)
Caused by: java.lang.NoClassDefFoundError: Unable to load class org.apache.groovy.jaxb.extensions.JaxbExtensions due to missing dependency javax/xml/bind/Unmarshaller
at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:407)
at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:280)
at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:400)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.scanExtClasses(MacroMethodsCache.java:88)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.access$000(MacroMethodsCache.java:45)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$2.onModule(MacroMethodsCache.java:69)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:81)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModulesFrom(ExtensionModuleScanner.java:63)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:54)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.getMacroMethodsFromClassLoader(MacroMethodsCache.java:76)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$1.provide(MacroMethodsCache.java:53)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$1.provide(MacroMethodsCache.java:50)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:123)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.get(MacroMethodsCache.java:50)
at org.codehaus.groovy.macro.transform.MacroCallTransformingVisitor.findMacroMethods(MacroCallTransformingVisitor.java:118)
at org.codehaus.groovy.macro.transform.MacroCallTransformingVisitor.visitMethodCallExpression(MacroCallTransformingVisitor.java:89)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
plus more.......................................
Also got the same issue when using java 11.0.2 and groovy 2.5.5 in IntelliJ.
Found this post that helps! https://www.logicbig.com/tutorials/misc/groovy/intellij.html
Basically have to add JAXB dependencies
Also you have to add JAXB dependencies if you are using Groovy 2.5.3 + Java 11 (also check out Java 11 related change). Groovy comes with extra JAXB Jars so we can add them. Open 'Project Structure' dialog, then select 'Dependencies' tab and add the dependencies as shown
Three suggestions are in the release notes for 2.5.1:
http://groovy-lang.org/releasenotes/groovy-2.5.html#Groovy2.5releasenotes-Addendum251
In 2.5.2, probably a week or two away, you won't need to do them - grab the snapshot version from the CI server if you want to try it out now.
I've also got this when I debugged some my groovy scripts with groovy 2.5.4 and java 10.
Setting JAVA_OPTS=--add-modules java.xml.bind solved the mentioned problem for me.
I was able to solve this by adding the jaxb module to my gradle file. I like this solution because it changes your project configuration file instead of going into the IDE settings.
dependencies {
implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: '3.0.1'
implementation group: 'org.codehaus.groovy', name: 'groovy-jaxb', version: '3.0.1'
}
In case someone has had the same problem and other solutions didn't help, here what helped me:
Added "jaxb" dependency to my project.
Go to Run -> Edit configurations -> Templates -> Gradle -> In Gradle Project choose your own application.
Weird bug with Android Studio 2.2 when running a single test directly in IDE - I'll either have "No tests found" or run my previously compiled test.
Example:
#Test
fun testyTest() {
}
I'll create this test, and get the "No tests found". So I restart, and test is found! Obviously, the above test passes because it's empty. Next, I want my test to fail. So I manually throw an exception and add one line of code, below.
#Test
fun testyTest() {
throw RuntimeException()
}
Now I recompile, and this test passes too, because IntelliJ is for some reason has cached the previous test and reruns that. To get this test to properly fail - I must restart the IDE.
Anyone know what's going on? Note - I'm using Kotlin pretty heavily in this project.
EDIT 2: This is a JVM test (non-android, src/test/java) in an android library project.
EDIT: here's a full test class
package com.example.zak
import org.junit.Before
import org.junit.Test
class ExampleTest {
#Before
fun setUp() {
}
#Test
fun testyTest() {
//throw RuntimeException()
}
}
Found the fix...the issue only occurs when there's a variant selection conflict. Removing the conflict fixed the issue.
Check if you're have all these dependencies:
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile 'junit:junit:4.11'
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
}
Also as you're using Kotlin please disable entirely Instant Run in File -> Preferences.
EDIT: You're talking about tests in library - do modules and project has these dependencies and proper configuration.
It looks like after Gradle rebuilding, test works fine.
I found this bug description in the JetBrains IntelliJ bug tracking system. Here is the URL:
https://youtrack.jetbrains.com/issue/IDEA-149275
It discusses a change that was made to classloading that may impact Junit test execution. A workaround is suggested by adding a line to the options.xml config file. Here is an example workaround for Windows boxes - change as necessary for your platform. The version of Android below is the current 2.2 release:
1) exit Android studio
2) navigate to the config/options directory for your Android version:
e.g. C:\Users\YourNameHere\.AndroidStudio2.2\config\options
3) then add the "<property name="idea.dynamic.classpath.jar" value="false" />" line inside the component block of the options.xml file:
<component name="PropertiesComponent">
<property name="idea.dynamic.classpath.jar" value="false" />
Start Android Studio and try running local Junit tests.
I guess you use gradle in your project? I had the exact same problem and the solution was to use gradle to execute tests (inside the gradle task list) instead of using the menu (right click on the test file and run tests).
I'm trying to use the ShowcaseView project in my project on Android Studio but can't get the project to build.
Showcase link: https://github.com/amlcurran/ShowcaseView
I have included the following:
In app/build.gradle-
compile 'com.github.amlcurran.showcaseview:library:5.4.1'
In build.gradle-
repositories
{
mavenCentral()
}
I get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.github.amlcurran.showcaseview:library:5.4.1.
Required by:
BLEDemo:app:unspecified
> Could not resolve com.github.amlcurran.showcaseview:library:5.4.1.
> Could not get resource 'https://jcenter.bintray.com/com/github/amlcurran/showcaseview/library/5.4.1/library-5.4.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/github/amlcurran/showcaseview/library/5.4.1/library-5.4.1.pom'.
> Connection to https://jcenter.bintray.com refused
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Ive tried several suggestions online but couldn't find a solution to this.
I have also tried to import the library an include it in settings.gradle and get an error.
Can some please help me.
Thank you in advance.
It looks like gradle is searching for the library in jCenter. If you add jCenter to your repositories closure does it work? Like this:
repositories
{
mavenCentral()
jCenter()
}
Are there any proxy-servers in use in your environment? If yes: configure it with your user and password. The build cannot find the package, which is located on github and breaks with an error.
You can check this answer if you want to learn more how to do this: gradle-behind-proxy-in-android-studio-1-3
Since yesterday, I got Failed to find: io.realm:realm-android:0.71.0.
It is in my dependencies:
dependencies {
...
compile 'io.realm:realm-android:0.71.0'
...
}
Is this a bug?
The project compiled perfectly before.
What has changed since then:
Added Crashlytics
Bumped buildtoolsversion: buildToolsVersion "21.1.0"
Log:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_paidDebugCompile'.
Could not find io.realm:realm-android:0.73.1.
Searched in the following locations:
https://repo1.maven.org/maven2/io/realm/realm-android/0.73.1/realm-android-0.73.1.pom
https://repo1.maven.org/maven2/io/realm/realm-android/0.73.1/realm-android-0.73.1.jar
file:/C:/Users/thomasbeerten/.m2/repository/io/realm/realm-android/0.73.1/realm-android-0.73.1.pom
file:/C:/Users/thomasbeerten/.m2/repository/io/realm/realm-android/0.73.1/realm-android-0.73.1.jar
http://download.crashlytics.com/maven/io/realm/realm-android/0.73.1/realm-android-0.73.1.pom
http://download.crashlytics.com/maven/io/realm/realm-android/0.73.1/realm-android-0.73.1.jar
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/android/m2repository/io/realm/realm-android/0.73.1/realm-and
roid-0.73.1.pom
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/android/m2repository/io/realm/realm-android/0.73.1/realm-and
roid-0.73.1.jar
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/google/m2repository/io/realm/realm-android/0.73.1/realm-andr
oid-0.73.1.pom
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/google/m2repository/io/realm/realm-android/0.73.1/realm-andr
oid-0.73.1.jar
Required by:
YoMommaOClock:app:unspecified
Christian from Realm here. Thats odd, neither of these two things should have any effect on Realm.
Without further information i would check:
1) Do you have the following in your build.gradle file?
repositories {
jcenter()
}
2) Try running "./gradlew clean assemble --refresh-dependencies" from your project. That should refresh your local dependency cache.
Apart from that, we just released 0.73.1, I would suggest you upgrade to that version :)
This question already has an accepted answer but in case you still having problems like me, this is what worked for me i unchecked offline work at
settings -> build... -> build tools -> build->gradle
but before make sure you have jcenter() in your dependency as described in the accepted answer.
I use AS 0.4.2 then imported GMS as described in doc:
https://developer.android.com/google/play-services/setup.html
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v13:13.0.+'
compile 'com.google.android.gms:play-services:4.0.30' }
all what is detected by IDE is R class, but rest of code is invisible.
On the other hand I put following code:
import com.google.android.gms.common.GooglePlayServicesUtil;
(...)
private void connectGms(){
Log.d(MbcConstants.TAG,
"check for gms"+ GooglePlayServicesUtil.
isGooglePlayServicesAvailable(this));
}
And it works, but IDE still shows class name in red, but properly shows the params and returned type for method.
Ok - it seems like a bug in Android studio.
What I've done do fix it:
remove all dependencies (use F4 key) from project and the module
delete files from projectroot/.idea/libraries
open the module gradle.buld
add back all dependencies that are needed by your project to work. In my case:
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:appcompat-v7:19.0.0'
compile 'com.google.android.gms:play-services:4.0.30'
}
Synchronize gradle.build once again
Continue your adventure of love and hate or return to eclipse.
All you needed to do was hit the Sync Project with Gradle Files button after editing the build.gradle file by hand.