I am very new to the Android / Gradle build environment, and google helpt me a lot, but for this I have tried a lot of things, but can't seem to get it to work!!
When I try to load the Vitamio Library (its saved as .jar file inside /app/libs/vitamio/, everything goes well, there are no Gradle build error.. But when I start the app, it gives the error that 'vinit.so' cannot be found.. The solution is copying it manually to the static-libs....
See problem -> Vitamio Sample Error - java.lang.UnsatisfiedLinkError: Couldn't load vinit findLibrary returned null
Now my folder structure is as following:
ATTEMPT 1
Android Studio, Gradle, OpenCV and NDK
Error:(69, 0) Could not find property 'jniLibs' on task ':app:packageDebug'.
When I try with jniFolders, nothing happens.
I placed it inside a lot of folders, just to try.. But it doesn't make any difference...
UPDATE 1
I think the copying worked, I had to install NDK and add it to local.properties file, but now it gives the following error:
Error:Gradle: Execution failed for task ':app:compileDebugNdk'.
A problem occurred starting process 'command '/android/ndk/ndk-build'
Without any errors.. Any help in find a debug.log somehwere, because the error says nothing about whats going wrong...
Gradle lets you handle dependencies a lot easier than using JARs! Open the app build.gradle file (there are two, open the first one in your screenshot that you posted) and add this line:
compile 'me.neavo:vitamio:4.2.2'
in the dependencies section.
Related
this is my very first post, Big Deal to me, appreciate your help Colleagues.
I recently updated Android Studio, (this is why I don't like updating) it forced me to create a new gradle file it called Hello ESE.gradle (ESE being the Company's name), the file simple contains this :
group = "itet"
version = "1"
the updating placed this file in the res/values directory when I built, this caused an error saying the file needed to end in .xml,
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
/Users/lokeke/AndroidStudioProjects/CalorieCountdownAppforAndroidBrown/app/src/main/res/values/Hello ESE.gradle: Error: The file name must end with .xml
I thought a gradle does not belong in the values directory so I removed it and put in the build directory but now the errors are even worse, I moved this Hello ESE.gradle to other places where gradle could look for it but still nothing works it won't build, don't know what to do now (how I wish I could go back to pre-update!!!)
I just simply updated all the tools I was using, Gradle, SDK, the works, and transferred to the Hello gradle file to the gradle.properties directory, this seems to have fixed it.
I am not able to figure out why this error is coming
Here is full error
Error:Execution failed for task
':app:transformClassesWithMultidexlistForDebugAndroidTest'.
> java.io.IOException: The output jar is empty. Did you specify the proper
'-keep' options?
My gradle android project was not having "androidTest" so I created manually and test folder here is screenshot of folder structure
I would not consider it as perfect answer but this is what i did.
I removed testInstrumentationRunner="android.support.test.runner....." from build.gradle file and restarted
It starts working :)
It is just for information
Background
I'm trying to import an old Eclipse JNI project (here), and yet even after all my attempts, I always fail.
The project worked fine on Eclipse (well most of the times) and somehow many users have succeeded importing it and using it on Android-Studio. All except the creator - me.
I've put the instructions someone told me and also merged all changes that are related to this issue, but nothing still works for me.
What I've tried
I've tried to follow those steps:
Create a 'jni' folder under src/main/ folder and copy JniBitmapOprationsLibrary.cpp to this folder.
Add a package com.jni.bitmap_operations, and add JniBitmapHolder.java to this package.
Add your NDK path to local.properties
Import com.jni.bitmap_operations package where it will be used
And it should be fine, except the NewDirectBuffer issue on my side.
put the fake 0-sized "c" file into the 'jni' folder.
I've tried other special steps I've found too, but nothing works. This is the current error I'm getting:
Error:Execution failed for task
':jnibitmapoperationslibrary:compileDebugNdk'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command
'D:\android\ndk\ndk-build.cmd'' finished with non-zero exit value 2
The question
How do I really suppose to import or create JNI projects on Android Studio? Will the projects be able to compile and be debugged?
Hmmm, the JNI should not be in src/main. It should be in top of project folder.
I think it's all. I know there is also issues with gradle when trying to build native projects. Not sure they fixed it yet.
Also, take a look at other ndk tools, like "android update project -p ." which generates files needed to build (with ndk-build)
With Android studio v0.8.2, I am blocked with the following exception. With the beta release it was working very well. I have updated my IDE to 0.8.2 and deleted my target directory and trying to build again. I am struck now.
Execution failed for task ':app:processDebugManifest'.
com.android.manifmerger.ManifestMerger2$MergeFailureException: java.io.FileNotFoundException: /home/gopinath/code/bitbucket/android/productionapp/build/intermediates/exploded-aar/com.jakewharton.hugo/hugo-runtime/1.1.0/AndroidManifest.xml (No such file or directory)
As reported by the error, the file is actually missing in the mentioned path. For my other project in which I have hugo-runtime, the file exists and compilation is proper.
Is anyone else facing this issue? Is there a workaround for this?
Click the build tab and clean Project. Boom!
Posting so that it might help others:
I ran into this issue as well. The error is from ManifestMerger and it made me believe it has something to do with my manifest file and that took me on a wrong path. This error can also happen in case of an invalid XML file in your resources. In my case it was a layout file that got left over from a merge conflict with nothing in it (an empty layout file) which in turn caused the issue. it also cloud be any other xml file so I would suggest opening your xml resources one at a time and see if there is any error in them (you will get the lint error when opening the file)
Everything fine with the command line
gradle build
But Android Studio keep saying that
Failed to complete Gradle execution
Cause:
A fatal exeption has occurred. Program will exit
If I clear all the cache, and restart everything will be fine, but this dialog will easily comeback again (after a build fail). I guess that the increment build chain is not good, but the message is not helpful at all.
Are there anythings I can do to get a more details message about what going on, why AndroidStudio Gradle failed? where can I put thing like --stacktrace in the Preferences of Android Studio?
If you got a problem like this in Android studio, then don't worry about that, you are missing some thing which are here.
Go to File-->Setting-->Gradle-->Gradle Vm Option,
Now put this value -Xmx256m in the box, and hit the Apply button.
Here you have solved the problem.
At my case, I forgot to include some jars at Libs folder at the Gradle file, actually I forgot to add ".jar" to the end of jar file name.
In my case, it was not VM Option and Clean and Build did not work. My problem was that there were some images in res folder (so no grammatical errors) and Android Studio/IntelliJ return this error and saying nothing about images... check all external data sources in each file.