Using Android Studio Facebook SDK - java

I am following the instructions here, however I am running into problems at step 3 "Import the SDK into an Android Studio Project". I imported the Module and set to compile as specified however, when I try to modify the settings.gradle I am running into problems. It keeps giving me Gradle 'MyApplicationProject' project refresh failed: You are using an old, unsupported version of Gradle please use 1.6 or higher. I am build the app with version 4.3 compiler while supporting all the way to 4.0(Android).
This is my settings.gradle
include ':MyPeeps'
include ':libraries:facebook', ':MyApplicationProject'
after is wasn't auto populating I added
dependencies {
compile files('libs/android-support-v4.jar')
compile project(':libraries:facebook')
}
Also put this into the build.gradle
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
When I go to put in the onCreation command for facebook errors with all the commands that use the facebook api. Does anyone know how I can fix my gradle issues?

Change 'com.android.tools.build:gradle:0.4' to 'com.android.tools.build:gradle:0.5.+'

I decided to drop android studio and just go back to adt plugin got it work quickly at that point. Thanks for the help.

Related

Can not find symbol method metafactory(Lookup,String,MethodType,MethodType,MethodHandle,MethodType)

After integrating firebase in react native i am getting this error. I have searched and tried to change the gradle version as well moreover i have reinstalled the sdk build tools.
Here is my build.gradle configurations
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
had the same issue using build tools 28.0.3,
first on android studio goto Tools > SDK Manager > SDK Tools
Tick "Show Packages Details"
UnTick the 28.0.3 to uninstall then ok
Tick again to install

Unable to integrate OpenCV in android studio

I am trying to integrate openCV in Android studio for my latest project. I followed the following steps:
Imported new module ..\OpenCV-android-sdk\java\
Added dependancy OpenCVLibrary320
Changed compilesdk and targetsdk versions to 23 and buildToolsVersion to 25.0.0 in the build.gradle of OpenCVLibrary320
Copied the contents of ..\OpenCV-android-sdk\sdk\native to app\main\src\jniLibs (After creating a jni folder)
Wrote a snippet of code to test if it was working
But I got the error:
Error:Execution failed for task ':app:compileDebugNdk'.
Error: Your project contains C++ files but it is not using a supported native build system.
Consider using CMake or ndk-build integration with the stable Android Gradle plugin:
https://developer.android.com/studio/projects/add-native-code.html
or use the experimental plugin:
https://developer.android.com/studio/build/experimental-plugin.html.
How can I fix this problem?
Note: In step 4, I created the jniLibs folder but it did not show up in the 'Android' view so I had to copy the contents to the jniLibs folder in the 'Project' view.
In gradle add module dependency:
include ':libraries:opencv'
add in build.gradle with this content
apply plugin: 'android-library'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0.0"
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
aidl.srcDirs = ['src']
}
}
}
Manualy add the jar file in the lib folder,
app -> libs -> xyz.jar
This will also create duplicate jar issue, remove from the previous folder, because it gets compiled twice if you do not remove

Gradle doesn't pack JNI *.so libraries into APK file

I have pretty large source tree which includes JNI sources as well:
android {
compileSdkVersion 19
buildToolsVersion '21.1.1'
lintOptions {
abortOnError false
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
aidl.srcDirs=['src/main/aidl']
assets.srcDirs = ['src/main/assets']
jni.srcDirs=[] //to suppress makefiles autogeneration
//jni.srcDirs=['src/main/jni']
jniLibs.srcDirs=['src/main/libs'] //native *.so in armeabi x86 and mips to include
}
}
}
//skipped
dependencies {
apt 'org.androidannotations:androidannotations:3.0+'
compile 'org.androidannotations:androidannotations-api:3.0+'
compile project(':actionbarsherlock')
compile project(':actionbarsherlocki18n')
compile 'com.android.support:support-v4:21.0.2'
compile 'com.google.code.gson:gson:2.2.4'
compile files('libs/acra-4.5.0.jar')
compile files('libs/libphonenumber-5.9.jar')
compile files('libs/universal-image-loader-1.8.6.jar')
}
ant.importBuild 'src/main/jni/build_native.xml' //ant task to build JNI
Everything works except Gradle doesn't put *.so files into final APK file. Ant really generates *.so libraries and put them into src/main/libs/x86 and src/main/libs/armeabi folders - I have double checked it.
I'm really stuck with this issue - please help.
BTW: Merry X-Mas!
Key point in my case was:
compileSdkVersion 21 //instead 19
As soon as I have changed compileSdkVersion from 19 to 21 - problem was resolved (required also to change JDK 6 to JDK 7.
Magic...

How import eclipse project to android studio 0.4.6 ?

I have project in eclipse and use android 2.3.3(API 10), but when I need import this project to android studio 0.4.6 thin android show me massage to fixed my project after I click fixed show me error `"Execution failed for task ':preBuild'.> Build Tools Revision 19.0.0+ is required."
please how I can fixed this error.
That my gredle-wrapper .properties:
#Thu Apr 17 01:07:57 PDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
That my build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 8
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['use','src']
resources.srcDirs = ['use','src']
aidl.srcDirs = ['use','src']
renderscript.srcDirs = ['use','src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
Please till me, any version eclipse I can export project to import in android studio.
All version eclipse is true to export.
You need to update the Build Tools Revision to version 19.0.0
open your sdk manager and update ( use the sdk directory associated with android studio not eclipse)
You might as well try to migrate your project from eclipse to make it easier when importing it in eclipse.
Let me know if this is not working

Android- Importing external libraries with Android Studio

I am new in Android and AndroidStudio, so I`m if this question seems a little bit idiot.
I want to import this project https://github.com/timroes/EnhancedListView/wiki but I cannot make this work.
I follow the steps and the .arr was added sucessfully to /build, but I still cant use the classes.
For some reason there is no .jar of this project in my external libraries folder.
I have to do something else to get the lib into External Libraries folder?
Here is my build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:gridlayout-v7:19.0.0'
compile 'com.android.support:appcompat-v7:19.0.0'
compile 'de.timroes.android:EnhancedListView:0.2.0#aar'
}
Upgrade to Android Studio 0.4.3, Android Gradle plugin 0.8.+, and Gradle 1.10. Problems with newly added library imports have been fixed in 0.4.3, and that version of Android Studio requires newer versions of the plugin and Gradle.

Categories

Resources