I've followed this stack overflow answer to try and get OpenCV android working in Android Studio. I have followed the directions with the following caveats:
The build tools version in the opencv build.gradle is 19.1.0 instead of 19.0.1
Instead of looking like the picture provided after a gradle sync, my project structure looks like this:
When I open the module dialog, opencv appears as a model, as well as app
The project builds and autocompletes fine. However, I get the following error when the code that requires OpenCV is called:
java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.core.Mat.n_Mat:()
I have no idea what I am doing wrong. Any help is appreciated.
You have to explicitly load libs with LoadLibrary:
http://developer.android.com/reference/java/lang/System.html
Related
I'm trying the object detection API (Git repo) from Tensorflow with android and when I build the project with bazel everything works fine and the libstensorflow_demo.so is there and loads normally. But when I try to to build the project with Gradle only and manually add the library to the JniLibs following this and this Github issue but I get the error mentioned in the title with an other error :
ObjectTracker: Native object tracking support not found. See tensorflow/examples/android/README.md for details.
Anyone encountered this problem?
I am trying to configure AspectJ in Android Studio. But after all trial and error its not working ! Surprisingly I am able to make it work with Eclipse Kepler version The steps I followed for Android Studio
Created sample Android Project
File > Settings > searched for AspectJ in Plugin section
Assuming nothing more to be done in Studio , except configuration of build.gradle files
Added compile 'org.aspectj:aspectjrt:1.8.1' to the to the build.gradle (Module:app)
Created Analytics_onBackPressed.aj for back button press detection
Created Analytics_OnClick.aj for click events detection
Created Analytics_onCreate.aj for components oncreate event detection
Created necessary dependency classes which the above mentioned *.aj classes will internally call
Added required permissions in Manifest
Running the project is not detecting any of the events (button click, oncreate or back button click)
Followed these links ReferenceLinkOne , ReferenceLinkTwo and ReferenceLinkThree
My Question is what is more required to make AspectJ working with Android Studio
Steps followed in Eclipse and got AspectJ working
Downloaded Eclipse Kepler version
Through Install New Software option searched for http://download.eclipse.org/tools/ajdt/43/update
Installed AspectJ Development Tools (Required) .
Created sample android project
Created Analytics_onBackPressed.aj for back button press detection
Created Analytics_OnClick.aj for click events detection
Created Analytics_onCreate.aj for components oncreate event detection
Added required permissions in Manifest File
Right clicked in project and converted project to AspectJ by the following
Configured Java build path with AspectJ runtime library
Now while running the project, I am able to detect components oncreate, back button press
Environment Used
Android Studio : 2.1.2
JRE : 1.8.0
Windows 7 Enterprise
Any help is highly appreciated!
EDIT : 1 , From the output , still AspectJ is not properly configured
As per this link , I created jar file from eclipse including *.aj files and corresponding dependency. Excluded AndroidManifest.xml while creating jar file and created jar
Created Project in Android Studio. Placed this *.jar file in libs file. (apps> libs). I have enabled AspectJ waving as shown below
Now searched the properties for AspectJ and enabled
Now running the project, should be creating logs I had put in *.aj files which is in plugin . Unfortunately these logs are not printed in Android Studio logs.
Form which I am concluding still AspectJ is not enabled in this project OR there is a configuration error
Disclosure: I am the author of the inofficial AspectJ weaver plugin.
As noted in the AspectJ weaver plugin documentation, the plugin does not support compiling .aj files.
To use this plugin, you have two options:
Switch from .aj to annotation style aspects.
Compile the .aj files outside the IDE (IntelliJ Community / Android Studio), for example using Maven/Gradle/Ant, and package them into a .jar. Include this .jar as a dependency in your project and click the Search for aspects... button, as per the documentation.
I have had various success trying to get AspectJ working in Android Studio. This link helped me get part of the way there (assumes Gradle build setup for your project). http://fernandocejas.com/2014/08/03/aspect-oriented-programming-in-android/
Using the custom block of code in the build.gradle file, I was able to get aspects defined using annotations in .java files compiling and weaving properly in my project. However, this same method did not work for me when defining native aspects using .aj files. I hope it helps.
IntelliJ has no tooling support for AspectJ, and Annotation Style AspectJ can work on Android studio. Just treat the aspect code as Java code.
For detail read this issue
aspectj for Android studio - where is AJDT plugin
Also, you can use gradle plugin aspectjx which can weave kotlin code and demo is here
I'm attempting to create an Android app with Android Studio that uses source code from:
https://github.com/mapbox/mapbox-gl-native/
I will need to modify the source code, build and debug the changes, and commit those changes back to the forked repository I've made from mapbox-gl-native.
It appears much of the library code is in C++, while the project that uses the code will be in Java (if that makes a difference).
I've tried a bunch of things (mostly ignorant) and keep getting the following message:
Gradle 'name' project refresh failed
Error: Configuration with name 'default' not found.
Newbie on Android Studio, so please be as descriptive as possible. I'm using Android Studio 1.4.1, as other similar questions seem to have version specific answers.
Is there a description on how to set up an Android Studio project to include source code and how to structure such a project?
or
Can you tell me what the message means and how to fix it?
Thanks.
In an android project, when you install library with gradle
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
Is there a way to look at the source of the library?
edit
https://developers.facebook.com/docs/android/getting-started
Talks about the sample code is included in the sdk. How do I view this sample source?
You can see the source code and the samples of Facebook Android SDK on GitHub:
https://github.com/facebook/facebook-android-sdk/
https://github.com/facebook/facebook-android-sdk/tree/master/samples
you can to initialize FB sdk 4.0 in sattings.gradle file
include ':app', 'FacebookSdk'
it will load whole SDK.
but still it gives you just iml file. it just pulls everything dynamically when called.
----------- Edit ----
I just tried rightnow,
If you are using android studio,
Just select your project explorer, as Project. generally its Android.
it that you will see whole list.
I can see facebook folder with all of its classes.
Let me know if it works for you.
Here in my project i have initialized FB SDK 4.0.
I am trying to get this example project to work: http://simonmacdonald.blogspot.co.uk/2012/10/barcode-scanner-example-projects.html
I have imported both the projects and made the library project a library etc and i have it running but when i run it and click the scan button i get:
Uncaught TypeError: Object [object Object] has no method 'exec' at file://android_asset/www/cordova.js:863
I have changed the target version to 17 (the latest) which allowed me to run it but i cannot seem to get it to work am i missing something?
I would like to run this on my Google Nexus 4 if this info helps.
Here is a zip of all the code i am using: https://dl.dropboxusercontent.com/u/1099165/bc-code.zip
Also i am using Eclipse to run this (ADT)
Because your barcodescanner.js is using old API call. There is no longer cordova.exec. You need to use the latest barcodescanner.js: https://github.com/phonegap/phonegap-plugins/blob/master/Android/BarcodeScanner/2.2.0/assets/www/barcodescanner.js
After Noogen's answer it got me thinking if Cordova needed to be updated so i grabbed the latest phonegap files and replaced the cordova.js file and the 2.8.1 jar file and then did a clean and build - it worked!