I'm wanting use this github project: https://github.com/makovkastar/FloatingActionButton in my android app, however I dont know if I have to download the project and move to libraries package, or if I have only do this:
dependencies {
compile 'com.melnykov:floatingactionbutton:1.1.0'
}
You need search the file build.gradle of your whole app folder.
There should be 2 of them, open the file under app folder you will see some like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.melnykov:floatingactionbutton:1.1.0'
}
Put compile 'com.melnykov:floatingactionbutton:1.1.0' in dependencies
You don't need to download the source code if just want to use the library.
Just add line compile 'com.melnykov:floatingactionbutton:1.1.0' to dependencies section in build.gradle
Related
I'm building an app with Android Studio.
This is my grandle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.mcsolution.easymanagementandroid"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.0'
compile files('libs/gson-2.2.4.jar')
compile 'com.itextpdf:itextg:5.5.9'
compile 'com.android.support:cardview-v7:25.0.0'
}
If I try to start my application, I can use it never problem.
If I try to upen all view.xml file, I have this error:
The SDK Platform-TOOLs version (23.1) is too old to check APIs compiled with API 26; please update more....
How can I change Platform-TOOLs and fix my problem ?
Open SDK Manager
Go to system settings > Android SDK
Go to SDK Tools Tab
you will find Android SDK platform-Tools 23.1 and you will find an update available
just update it
As also reported in this link
I am trying to add this dependency to gradle, but I am receiving the below errors about other dependencies which I have not added in the first Place.
Errors :
Dependency I am trying to add is com.wdullaer:materialdatetimepicker:3.1.3
build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.pf.datetimepicker"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:+'
compile 'com.wdullaer:materialdatetimepicker:3.1.3'
}
which I have not added in the first Place.
Sure you did...
Look at the source of the library you got. https://github.com/wdullaer/MaterialDateTimePicker/blob/master/library/build.gradle
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:support-v13:25.2.0'
compile 'com.android.support:design:25.2.0'
First, you need compileSdkVersion 25 for those to even work, then you need to allow Android Studio to "Install Repository and Sync Project" or do it yourself by updating the SDK Manager.
Change your compile and targetsdk to 25
Change your compileSdkVersion, buildToolsVersion andtargetSdkVersion
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.pf.datetimepicker"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:+'
compile 'com.wdullaer:materialdatetimepicker:3.1.3'
}
You have not installed the newest version of android support libraries. Just open SDK manager and install them. See the image
My project have two modules:
App
Facebook-lib
Here are my gradle files:
setting.gradle
include ':app', ':facebook-lib'
Module App gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.app.test"
minSdkVersion 18
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile project (':facebook-lib')
}
Module Facebook-lib gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 18
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
}
Whenver I am trying to access Facebook-lib class in App module. It works but I can't do vice versa.
I get com.app.testpackage doesn't exist or cannot find symbol class.
What I am doing wrong here?
You can't achieve it.
Your Module App has a dependency with the Module Facebook library. It means that you can use the classes inside the library in your main module.
Your Facebook library doesn't have a dependency with your module. It means that you can't use the classes in main module.
Also you can't create a circular dependency.
Solved
Finally I solved it. You can find my code Here
This is specific to this lib. I want detail explanation on how to add it in my project and use either of zxing or zbar.
As instructed compile 'me.dm7.barcodescanner:zxing:1.7'
is giving gradle project failed while syncing.
I have added that lib inside libs/barcodescannerLIB
settings.gradle
include ':app'
include ":libs:barcodescannerLib:core", ":libs:barcodescannerLib:zxing:zxing", ":libs:barcodescannerLib:zxing:sample", ":libs:barcodescannerLib:zbar:zbar", ":libs:barcodescannerLib:zbar:sample"
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.dxd.testbs"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/libs'] } }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile project(":libs:barcodescannerLib:core")
compile project(":libs:barcodescannerLib:zxing:zxing")
compile project(":libs:barcodescannerLib:zxing:sample")
compile project(":libs:barcodescannerLib:zbar:zbar")
compile project(":libs:barcodescannerLib:zbar:sample")
}
Add in your build.grandle file the support dependence:
dependencies {
compile 'com.android.support:support-v4:19.+'
}
I'm using this library to add Transition Effects to ViewPager. Since it is a library project, I've imported it as a module in Android Studio and then I added it to my project as a dependency. But now, when I try to run my project, Android Studio builds and runs the library project instead of my app, which's completely different from mine. But, when I run the same project using Eclipse, it runs perfectly and my app works as usual. I've no idea why this's happening.
Here's the build.gradle file of my main module -
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 8
targetSdkVersion 14
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:gridlayout-v7:19.0.1'
compile 'com.android.support:support-v4:19.0.1'
compile 'com.android.support:appcompat-v7:19.0.1'
compile project(':comjfeinsteinjazzyviewpagerMainActivity')
}
Here's the build.gradle file of the library project -
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
packageName 'com.jfeinstein.jazzyviewpager'
minSdkVersion 8
targetSdkVersion 14
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_5
targetCompatibility JavaVersion.VERSION_1_5
}
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
dependencies {
compile files('libs/nineoldandroids-2.4.0.jar')
compile 'com.android.support:support-v4:19.0.1'
}
settings.gardle -
include ':launcher'
include ':lib'
Launch Configurations -