0

I want to create a Speaker Recognition Android app using android studio.

I came accross https://github.com/amaurycrickx/recognito Library in java. But I am having difficulty in implementing it in Android.

First, I saved the recognito folder by copying it in libs folder (creating it manually) in my main directory of my android app.

Then, in settings.gradle file -- include ':recognito'

build.gradle app file --     compile project(':recognito')

After sync. getting the error -

Error:Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :recognito.

I researched, Gradle error: configuration declares dependency which is not declared It says that since build.gradle file doesn`t exists for the Recognito project. But how will it? Cos it contains only java files.

Please help ..

Build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.urvi.android.abc"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile project(':recognito')

}

settings.gradle

include ':app'
include ':recognito'

and the folder Recognito I copied has https://github.com/amaurycrickx/recognito/tree/master/recognito files. I did not copy from the initial path

ugola
  • 300
  • 3
  • 18
  • Please share your full gradle files – ligi Jun 07 '17 at 07:54
  • this project seems old so it must be built on eclipse, anyway you can create a gradle by yourself for the project – shadygoneinsane Jun 07 '17 at 08:06
  • can you please try include ':app','recognito' in settings.gradle? This is how I always do it and it works - not sure if 2 includes work – ligi Jun 07 '17 at 08:13
  • 1
    *Latest commit eae9ca1 on 8 Sep 2014* => When you read this, you know you have found yourself a gem. Use in production code for unexpected yet funny results... – 2Dee Jun 07 '17 at 09:06
  • @shadygoneinsane how to create a build.gradle file for this java project? – ugola Jun 07 '17 at 09:39
  • @ligi I tried, but did not work :/ – ugola Jun 07 '17 at 09:40
  • Ah just seeing the library does not use gradle - the way you try it you can only add gradle libraries – ligi Jun 07 '17 at 09:44
  • @UrviG is your problem solved ! – shadygoneinsane Jun 08 '17 at 07:40
  • @shadygoneinsane I added all java files manually, changed the package name. Still having issues in using classes in Javax package and File classes which are supported in eclipse and not in android. So i need to figure out alternative to these classes.. – ugola Jun 08 '17 at 08:57
  • @UrviG I understand this can be frustrating. [Anyways here is a library which I think I will serve you well let me know if you aren't able to use this](https://www.dropbox.com/s/ujl4apql02vo0ck/recognito.zip?dl=0) :) – shadygoneinsane Jun 08 '17 at 09:59
  • @shadygoneinsane Thanks! :) looks useful, will try to use it in android. but there are some libraries of JAVAX package which are used in recognito and android wont use them. Will that problem arise when I will try to use this library u sent in my android project? – ugola Jun 08 '17 at 10:47
  • @UrviG I only compiled it, you can create a small test run and check :) – shadygoneinsane Jun 09 '17 at 05:28

2 Answers2

1

It seems that this library has not been made to be used for Android app but Java application. It uses parts of the Java API not available for Android (like javax.sound.sampled.*). Plus I'd not recommend to use any library not being updated in the last 3 years.

Eselfar
  • 3,759
  • 3
  • 23
  • 43
  • yes but.. Unable to get other open source speaker recognition API in java :/ – ugola Jun 07 '17 at 09:41
  • In that case, you can maybe use this lib as a base to create your own, as the calculation and so on, should probably be the same for Android? – Eselfar Jun 07 '17 at 09:47
0

The way you try to add the library it needs to have gradle build-files. I see 2 ways to solve the problem:

  • create a jar from the library and include it this way
  • use a service like jitpack to include the library

For generating the jar: * clone the repo * cd recognito * mvn package

then you get:

Results :

Tests run: 53, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ recognito ---
[INFO] Building jar: /home/ligi/git/3rd/recognito/recognito/target/recognito-0.1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.318 s
[INFO] Finished at: 2017-06-07T11:58:23+02:00
[INFO] Final Memory: 21M/302M
[INFO] --

there is your jar - now include it.

ligi
  • 39,001
  • 44
  • 144
  • 244
  • Thank you :) For step 1, is this https://www.cs.utexas.edu/~scottm/cs307/handouts/Eclipse%20Help/jarInEclipse.htm link alright? – ugola Jun 07 '17 at 09:55
  • Whats the difference between JAR and executable JAR? – ugola Jun 07 '17 at 09:56