I am trying to incorporate Houndify API into my project. However my gradle file would not build.
I downloaded a sample project from their site and it worked normally. I am migrating codes from that project gradle file to mine.
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "edu.drexel.cs.ptn32.pennapps"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
signingConfigs {
debug {
storeFile file("debug.keystore")
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
repositories {
maven {
// The username and password for this repo is set below
url 'https://houndify.com/maven/'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile ('hound.android:hound-sdk:0.2.15#aar'){
transitive=true
}
compile ('hound.android:phrasespotter:1.4.0'){
transitive=true
}
}
setHoundifyMavenCredentials("user", "pw")
def setHoundifyMavenCredentials(username, password) {
for (repo in repositories) {
if (repo.properties.url.toString().equals("https://houndify.com/maven/")) {
repo.properties.credentials.username = username
repo.properties.credentials.password = password
}
}
}
Sorry to hear you are having problems migrating the Houndify SDK into your app. To make things easier, we've just removed the password restriction on the https://houndify.com/maven/ website. This means you can remove the setHoundifyMavenCredentials() portion from your build.gradle file. I suggest pulling the latest version of the Houndify sample app houndify-sdk-sample-0.2.17.zip and making sure it builds OK on your system, then all you should need to do is to add these lines to your build.gradle and it should pull in the Houndify libraries.
repositories {
maven {
url 'https://houndify.com/maven/'
}
}
dependencies {
compile ('hound.android:hound-sdk:0.2.15#aar'){
transitive=true
}
compile ('hound.android:phrasespotter:1.4.0'){
transitive=true
}
}
Finally make sure you Android build system is up-to-date.
Please let us know if you are still running into problems and thanks for your feedback. http://www.soundhound.com/contact
Related
Gradle SYNC is taking more than 3hrs. The code seems to be Syncing forever (i have tried rebooting Android Studio but it does not help), I am observing this after updating Gradle and Android studio yesterday. It is stuck in Gradle Sync Condfigure build and taking forever to complete and finish
I have tried following tricks and techniques:
1) Updated Android Studio to 3.5
2) Tried File-->Settings-->Gradle-->Offline Work
3) Internet connection superfast
4) Not behind any Proxy or VPN
apply plugin: 'com.android.application'
//***********************************************************************************************//
def IOTHUB_DEVICE_CONNECTION_STRING_ENV_VAR_NAME = project.hasProperty('DeviceConnectionString') ? '"'+project.property('DeviceConnectionString')+'"' : '"Define Device Connection"'
def STRING='String'
//***********************************************************************************************//
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.iothub.azure.microsoft.com.androidsample"
minSdkVersion 24
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0"
each {
//buildTypes.mBuildConfigFields 'DATATYPE','VARIABLE',|"GRADLE VARIABLE|"'
buildConfigField STRING, 'DeviceConnectionString', IOTHUB_DEVICE_CONNECTION_STRING_ENV_VAR_NAME
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude "META-INF/MSFTSIG.SF"
exclude "META-INF/MSFTSIG.RSA"
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'thirdpartynotice.txt'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation ('com.microsoft.azure.sdk.iot:iot-device-client:1.14.2'){
exclude module: 'azure-storage'
}
implementation ('com.microsoft.azure.android:azure-storage-android:2.0.0#aar')
implementation ('org.apache.commons:commons-lang3:3.6')
}
repositories {
mavenCentral()
}
I am getting an error like
Error:cannot generate view binders java.lang.StringIndexOutOfBoundsException: String index out of range: -8
Few minutes before, my code was running well and I was able to run the project. I have tried many solutions as given over stackoverflow but not able to find out actual solution to this problem.
My app level gradle is like
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.xyz.abc"
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
dataBinding {
enabled = true
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:customtabs:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
}
apply plugin: 'com.google.gms.google-services'
Any input from your side is highly appreciated.
I am to find the solution for my above problem. This is some silly mistake I have done in my layout file under tag. I have written code like
<variable
name="deliveryPreferences"
type="java.util.ArrayList>String<" />
instead of
<variable
name="deliveryPreferences"
type="java.util.ArrayList<String>" />
The difference here is for > and < text placement. I got confused between these two. Right solution is second one if some want to send arraylist from yout Java file to xml file.
I am writing android project. Some of the external libraries requires the use of Java8. However, when I add Java8 using Jack, the project isn't recognizing the components of Java8. What might be the problem?
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.infiniteloop.android.translateyandex"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
jackOptions {
enabled true
}
}
dexOptions {
incremental true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildscript {
tasks.withType(JavaCompile) {
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.2.0'
compile 'com.github.vbauer:yandex-translate-api:1.2.5'
testCompile 'junit:junit:4.12'
}
And here is the error list
Errorlist
You use
multiDexEnabled true
Add above link to AndroidManifest.xml:
android:name="android.support.multidex.MultiDexApplication"
OR
MultiDex.install(this);
in your custom Application's attachBaseContext method
or your custom Application extend MultiDexApplication
and add above
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Hope it help.
You can use this gradle plugin for getting java lambda support in java 6, 7 and android
Just add: apply plugin: 'me.tatarka.retrolambda'
line in your app level build.gradle file below the line: apply plugin: 'com.android.application'
Now in your project level build.gradle add :
classpath 'me.tatarka:gradle-retrolambda:3.6.0'
in your dependencies section
EG:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'me.tatarka:gradle-retrolambda:3.6.0'
}
And sync it :)
In my android application i have to create charts, so I likes to use MPAndroidCharts for that.I saw the latest release on that is v3.0.1 but i can configure it on gradle correctly.I got below error when i use its gradle configuration.
Error:Gradle: A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.github.PhilJay:MPAndroidChart:v3.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.pom
https://jcenter.bintray.com/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.jar
file:/usr/local/lib/android-sdk-linux/extras/android/m2repository/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.pom
file:/usr/local/lib/android-sdk-linux/extras/android/m2repository/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.jar
file:/usr/local/lib/android-sdk-linux/extras/google/m2repository/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.pom
file:/usr/local/lib/android-sdk-linux/extras/google/m2repository/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.jar
What I am doing wrong?? Below is my gradle configuration.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.myproject"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile('org.springframework.android:spring-android-auth:1.0.1.RELEASE') {
exclude module: 'spring-core'
}
compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
}
You forgot to add that in your build.gradle (Project:...):
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
The problem is happening after I add the Realm Library to my project. I have this dependences in my gradle project:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'io.realm:realm-android:0.87.2'
}
I Found a lot of answers in the StackOverflow and I tested many of this but i have no success. Tryied this answer and this answer but i think my problem is something more specific.
I also added the suggestion of the LogCat error, but im getting the same error. Any answer will be appreciated.
I provide an image of the full error for a better look.
Move your android closure to be after the dependencies closure:
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'io.realm:realm-android:0.87.2'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
The LogCat show this error Gradle DSL method not found: 'packagingOptions()'
Then you do not have packagingOptions inside android.
This is the packagingOptions { I use to typically be able to build anything so far.
android {
...
packagingOptions {
// Exclude file to avoid
// Error: Duplicate files during packaging of APK
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}