I'm having issues when I try to use Bindroid in my Android Studio Project. I've set up a boilerplate app to create a HelloWorld example using Bindroid. I cloned the Bindroid source into my /libs folder. But when I go to run my app, I get a package Bindroid does not exist error.
I need to know how to import this code and use it with my project. For example, where should I place this code? How do I configure my project to use it? Here's my project structure:
EDIT
So I've added Bindroid according to the instructions, here is the resulting structure:
And here is my apps build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.sg.spencergardner.finance5"
minSdkVersion 9
targetSdkVersion 21
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:21.0.3'
compile project(':Bindroid:Bindroid')
}
And my project's settings.gradle:
include ':app'
include ":Bindroid"
You need to copy all the contents of this https://github.com/depoll/bindroid/tree/master/Bindroid under the folder name "Bindroid".
In your app's build.gradle, add.
compile project(':Bindroid:Bindroid')
:Bindroid:Bindroid corresponds to "Project Folder":"App/Library Folder". See https://github.com/depoll/bindroid/blob/master/BindroidSample/build.gradle#L5.
Also in your settings.gradle, you need to add ":app" and ":Bindroid".
Related
I have an Android Library MyLib,of which I need to create Android Archive (aar). This library is using two more dependcies, once is a abc.jar and the other is xyz.aar.
I have the abc.jar file in /libs folder of the library and for the xyz.aar added it as a module dependency.
The gradle file of the library looks like
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile project(':xyz')
}
Once I create the aar file for MyLib and trying to use it with a sample project, I am not able to utilize classes from xyz.aar where as classes from abc.jar are accessible.
That makes me wonder if one aar can contain another aar dependency inside it. Therefore is it possible to access aar inside anot
Use the android-fat-aar to create aar of Android Library containing another aar
I'm a beginner in android developing whith Android Studio.
I'm trying to include the htmlcleaner library in my project, but when I rebuild the project, Android Studio return this Error
Error: COnfiguration whit name 'default' not found
I added in the root folder of my project the library folder, so I added this line in settings.gradle
include ':htmlcleaner'
and this line in build.gradle
compile project (':htmlcleaner')
Is there anyone who can help me? thanks
to include many informations, I post the build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.rob_company_domain.sunshine"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile project (':htmlcleaner')
}
If you want to add your htmlcleaner library to your project in Android studio, you can do it in three standard ways. Please read this link https://stackoverflow.com/a/35369267/5475941. In this post I explained how to import your JAR files in Android studio and I explained all possible ways step by step with screenshots. I hope it helps.
I am trying to add to my build.gradle file in Android Studio the following dependency:
https://android-arsenal.com/details/1/1883
I followed the intstructions found in package tab of this page, but when I tried to build the project I got the following message:
Error:(32, 13) Failed to resolve:
com.github.DASAR:Minim-Android:a73b596916
Anyone can help me?
I also tried to download the project code and import it in Android Studio as a module, but it wasn't recognized as a library from the wizard.
Thank you all in advance.
You can download relative API in your AS SDK Manager, then add it in build.gradle. After that, check out the compileSdkVersion, targetSdkVersion are same with appcompat. My build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.0.1"
defaultConfig {
applicationId "com.example.android"
minSdkVersion 9
targetSdkVersion 19
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:19.0.0'
}
my sdk is 19
Best option is to fork the project and add a Gradle build file. Then use JitPack to build the fork.
Note that the project has dependencies in a libs/ folder so these would need to be converted to dependencies in Gradle.
This question is a sequel to this one.
In an existing Eclipse solution I have a library project which is used as a Android Dependency in the main app project. That means that if I edit this library, and compile, the main project is updated with the latest from that library.
I'm trying to do the same in Android Studio. That means not importing a library, but using it as a reference or dependency in the app project. I've been trying for two days now with no luck. Help is HIGHLY appreciated.
build.gradle (of the app project - there is nothing interesting her as I didn't change it much)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
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:21.0.3'
}
You can try this steps:
Download library
File/import module
Select your library and rename :LibraryName
Go to build.gradle and write.
build.gradle
dependencies {
......
compile project(':LibraryName')
.....
}
Then if you import module you can edit library and proyect its updated
Say you have 2 projects, 1 application and 1 library project, you want to push all your external dependencies to your library project, so your application project only depends on the library project:
settings.gradle
include ':app'
include ':library'
app/build.gradle
apply plugin: 'com.android.application'
dependencies {
compile project(':library')
}
library/build.gradle
apply plugin: 'android-library'
dependencies {
compile 'external-dependencies-1'
compile 'external-dependencies-2'
...
}
I want to use this library in a project in Android Studio, so as mentioned in read me, I created new project in the Android Studio and added dependencies in build.gradle file inside the app folder as:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.mycompany.swipe_instagram"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.lorentzos.swipecards:library:1.0.8#aar'
}
Then when I sync I started getting this error as:
I have Searched on the google and stack overflow but can't find any appropriate solution.
I used your "build.gradle" file and it is working fine for me (both with and without "aar"). Could be something wrong with the cache. Try "File -> Invalidate Caches / Restart"). Another way to generate more error message detail is to try building the module from the command line and getting verbose output
gradle -info compileDebugSources
You'll get lots of output which should give you a hint as to what's going wrong