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.
Related
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
I would like to know how to create a pom file with "Gradle Android Maven Plugin".
I followed the steps on http://www.gradle.org/docs/current/userguide/maven_plugin.html (chapter "Convention Methods"). I also created the directory "buildDir" and get no errors. The App was build successfully but nevertheless the pom file doesn't exist. I am using Android Studio IDE.
Is it possible that the newpom.xml file exists on runtime only and does not exist in my project folder buildDir after runtime? Maybe I am looking for something which can't be found.
My app/build.gradle looks like this:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 16
targetSdkVersion 19
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
apply plugin: 'maven'
task writeNewPom << {
pom {
project {
inceptionYear '2008'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}.writeTo("$buildDir/newpom.xml")
}
dependencies {
compile 'com.android.support:support-v4:+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:appcompat-v7:+'
compile files('libs/retrofit-1.5.1.jar')
}
Can someone tell me if I missed something? :)
Best Regards,
Philip
No need to create buildDir manually, it has default value and refer to /build folder that place in same folder as build.gradle file.
Did you run follow command?
gradle writeNewPom
after run it I got newpom.xml file in projectroot/build folder, BUT it contains no dependencies however I have dependencies in build.gradle file.
In my Android app, I'm getting a java.lang.NoClassDefFoundError when the code that references code in a dependent .jar is executed. My project includes an Android module as well as a java-only library module, which is where the jar dependency is. I'm using gradle 1.10 to build the project. Here is my project layout:
myProject
- app (Android)
- src
- build.gradle
- lib (java)
- src
- libs
- local-dependency.jar
- build.gradle
- build.gradle
- settings.gradle
The main project build.gradle is blank while the main project settings.gradle looks like:
include ':app', ':lib'
The Android app build.gradle looks like:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "19.0.2"
defaultConfig {
minSdkVersion 18
targetSdkVersion 18
versionCode 1
versionName "1.0"
}
}
dependencies {
compile project(':lib')
}
The library build.gradle is:
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile <some-dependency-in-maven>
compile files('libs/local-dependency.jar')
}
Everything compiles and packages with no errors and I'm not seeing any errors in the IDE (IntelliJ 13). For some reason, my local-dependency.jar is not getting added to the dex-ing process during the Android compile. Any maven dependencies specified in the lib project get added to the Android .apk just fine; it's just my local jar dependency. Is there something I'm missing?
Thanks!
This is not directly possible as local jars are not declared as transitive dependencies in Gradle.
You have two options:
merge the two jars in your java library so that the output contains the local jar.
create a different project with no source, only the jar, and make the project depend on it.
The second option gives you the ability to have more than one project depend directly on the local jar (on top of it becoming a transitive dependency). To do it, create a new gradle project and just put in its build.gradle the following:
configurations.create("default")
artifacts.add("default", file('somelib.jar'))
This simply register your jar as the default artifact published by the project and this will get consumed by the other projects.
In recent (4+, IIRC) versions of gradle, you can achieve this with the following configuration:
compile (project(':ProjectIDependOn')) {
transitive = true
}
Setting transitive to true when depending on another project will expose all of that project's libraries to this project.
I am trying to use code from this project: https://github.com/gabrielemariotti/cardslib, and I am trying to do this with intelij. In the instructions provided with the library it simply says to add this to build.gradle file:
dependencies {
compile 'com.github.gabrielemariotti.cards:library:1.3.0'
}
however when I add this and try to use code from the project intelij gives errors such as unable to resolve symbol, etc. So I am wondering what are the other steps needed to use code from this project that must be done using intelij. Any help is appreciated.
My build.gradle file currently looks like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile files('libs/android-support-v4.jar')
compile files('libs/GoogleAdMobAds.jar')
compile files('libs/libGoogleAnalyticsV2')
compile files('libs/amazon-ads-5.1.10.jar')
compile project('libraries/cardslib/library')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 16
}
}
dependencies {
// Cards Library
compile 'com.github.gabrielemariotti.cards:library:0.6.0'
compile project(':libraries:cardslib:library')
}
The documents here are also helpful to new Maven users.
Download and Install Maven - Download the latest version of Maven and install it
Quick Start - Get started building the project quickly
Use Maven - Learn how to use Maven on your own project
Refer this the below link to get much more details...
http://maven.apache.org/run-maven/
You need to add the maven central repository to your build file.
The simplest way is to just put this in your build.gradle directly under apply plugin: 'android':
repositories {
mavenCentral()
}
Resync your IDE with the gradle file after doing so.
It should resolve the dependency like any other maven central dependency (e.g. ABS).
If you are using sources (git repo cloned) at rootProject/libraries/cardslib, then add its library in rootProject/settings.gradle:
include ':appModule', ':libraries:cardslib:library'
and then in rootProject/appModule/build.gradle:
dependencies {
compile project(':libraries:cardslib:library')
}
Or, if you use maven, then just do this in rootProject/appModule/build.gradle:
dependencies {
compile 'com.github.gabrielemariotti.cards:library:1.3.0'
}
so the library's jar/aar will be downloaded in ~/.gradle/caches/modules-2/... and be compiled.
Pick one of above, don't do both.
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.