2015-07-25 1 views
0

Пытается использовать TextFairy-код на GitHub, чтобы создать приложение для Android, которое преобразует изображение в текст в качестве одной из его функций: (https://github.com/renard314/textfairy/tree/master/app/src/main/res), но оно вызывает эту ошибку: Пожалуйста, помогите! или предложить некоторые другие изображения в текст апи/Android App кодИзображение в текстовое приложение для Android

Executing tasks:  [:app:generateAV5DebugSources,:app:generateAV5DebugAndroidTestSources, :tesstwo:tess-two:generateDebugSources, :tess-two:tesstwo:generateDebugAndroidTestSources] 

Configuration on demand is an incubating feature. 
Returning version 640 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
Returning version 240 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
Returning version 140 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
signing.properties not found 
:app:preBuild UP-TO-DATE 
:app:preAV5DebugBuild UP-TO-DATE 
:app:checkAV5DebugManifest 
:app:preAV5ReleaseBuild UP-TO-DATE 
:app:preAV7DebugBuild UP-TO-DATE 
:app:preAV7ReleaseBuild UP-TO-DATE 
:app:preX86DebugBuild UP-TO-DATE 
:app:preX86ReleaseBuild UP-TO-DATE 
:tess-two:tess-two:compileLint 
:tess-two:tess-two:copyReleaseLint UP-TO-DATE 
:tess-two:tess-two:mergeReleaseProguardFiles 
:tess-two:tess-two:preBuild UP-TO-DATE 
:tess-two:tess-two:preReleaseBuild UP-TO-DATE 
:tess-two:tess-two:checkReleaseManifest 
:tess-two:tess-two:prepareReleaseDependencies 
:tess-two:tess-two:compileReleaseAidl 
:tess-two:tess-two:compileReleaseRenderscript 
:tess-two:tess-two:generateReleaseBuildConfig 
:tess-two:tess-two:generateReleaseAssets UP-TO-DATE 
:tess-two:tess-two:mergeReleaseAssets 
:tess-two:tess-two:generateReleaseResValues 
:tess-two:tess-two:generateReleaseResources 
:tess-two:tess-two:packageReleaseResources 
:tess-two:tess-two:processReleaseManifest 
:tess-two:tess-two:processReleaseResources 
:tess-two:tess-two:generateReleaseSources 
:tess-two:tess-two:ndkBuild FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':tess-two:tess-two:ndkBuild'. 
> A problem occurred starting process 'command '/Users/renard/devel/android-ndk-r9c//ndk-build'' 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 29.02 secs 
Executing tasks: [:app:assembleAV5Debug] 

Configuration on demand is an incubating feature. 
Returning version 640 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
Returning version 240 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
Returning version 140 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
signing.properties not found 
:app:preBuild UP-TO-DATE 
:app:preAV5DebugBuild UP-TO-DATE 
:app:checkAV5DebugManifest 
:app:preAV5ReleaseBuild UP-TO-DATE 
:app:preAV7DebugBuild UP-TO-DATE 
:app:preAV7ReleaseBuild UP-TO-DATE 
:app:preX86DebugBuild UP-TO-DATE 
:app:preX86ReleaseBuild UP-TO-DATE 
:tess-two:tess-two:compileLint 
:tess-two:tess-two:copyReleaseLint UP-TO-DATE 
:tess-two:tess-two:mergeReleaseProguardFiles UP-TO-DATE 
:tess-two:tess-two:preBuild UP-TO-DATE 
:tess-two:tess-two:preReleaseBuild UP-TO-DATE 
:tess-two:tess-two:checkReleaseManifest 
:tess-two:tess-two:prepareReleaseDependencies 
:tess-two:tess-two:compileReleaseAidl UP-TO-DATE 
:tess-two:tess-two:compileReleaseRenderscript UP-TO-DATE 
:tess-two:tess-two:generateReleaseBuildConfig UP-TO-DATE 
:tess-two:tess-two:generateReleaseAssets UP-TO-DATE 
:tess-two:tess-two:mergeReleaseAssets UP-TO-DATE 
:tess-two:tess-two:generateReleaseResValues UP-TO-DATE 
:tess-two:tess-two:generateReleaseResources UP-TO-DATE 
:tess-two:tess-two:packageReleaseResources UP-TO-DATE 
:tess-two:tess-two:processReleaseManifest UP-TO-DATE 
:tess-two:tess-two:processReleaseResources UP-TO-DATE 
:tess-two:tess-two:generateReleaseSources UP-TO-DATE 
:tess-two:tess-two:ndkBuild FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':tess-two:tess-two:ndkBuild'. 
> A problem occurred starting process 'command '/Users/renard/devel/android-ndk-r9c//ndk-build'' 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 8.917 secs 
Executing tasks: [:app:assembleAV5Debug] 

Configuration on demand is an incubating feature. 
Returning version 640 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
Returning version 240 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
Returning version 140 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
signing.properties not found 
:app:preBuild UP-TO-DATE 
:app:preAV5DebugBuild UP-TO-DATE 
:app:checkAV5DebugManifest 
:app:preAV5ReleaseBuild UP-TO-DATE 
:app:preAV7DebugBuild UP-TO-DATE 
:app:preAV7ReleaseBuild UP-TO-DATE 
:app:preX86DebugBuild UP-TO-DATE 
:app:preX86ReleaseBuild UP-TO-DATE 
:tess-two:tess-two:compileLint 
:tess-two:tess-two:copyReleaseLint UP-TO-DATE 
:tess-two:tess-two:mergeReleaseProguardFiles UP-TO-DATE 
:tess-two:tess-two:preBuild UP-TO-DATE 
:tess-two:tess-two:preReleaseBuild UP-TO-DATE 
:tess-two:tess-two:checkReleaseManifest 
:tess-two:tess-two:prepareReleaseDependencies 
:tess-two:tess-two:compileReleaseAidl UP-TO-DATE 
:tess-two:tess-two:compileReleaseRenderscript UP-TO-DATE 
:tess-two:tess-two:generateReleaseBuildConfig UP-TO-DATE 
:tess-two:tess-two:generateReleaseAssets UP-TO-DATE 
:tess-two:tess-two:mergeReleaseAssets UP-TO-DATE 
:tess-two:tess-two:generateReleaseResValues UP-TO-DATE 
:tess-two:tess-two:generateReleaseResources UP-TO-DATE 
:tess-two:tess-two:packageReleaseResources UP-TO-DATE 
:tess-two:tess-two:processReleaseManifest UP-TO-DATE 
:tess-two:tess-two:processReleaseResources UP-TO-DATE 
:tess-two:tess-two:generateReleaseSources UP-TO-DATE 
:tess-two:tess-two:ndkBuild FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':tess-two:tess-two:ndkBuild'. 
> A problem occurred starting process 'command '/Users/renard/devel/android-ndk-r9c//ndk-build'' 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 8.946 secs 
Executing tasks: [:app:assembleAV5Debug] 

Configuration on demand is an incubating feature. 
Returning version 640 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
Returning version 240 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
Returning version 140 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
signing.properties not found 
:app:preBuild UP-TO-DATE 
:app:preAV5DebugBuild UP-TO-DATE 
:app:checkAV5DebugManifest 
:app:preAV5ReleaseBuild UP-TO-DATE 
:app:preAV7DebugBuild UP-TO-DATE 
:app:preAV7ReleaseBuild UP-TO-DATE 
:app:preX86DebugBuild UP-TO-DATE 
:app:preX86ReleaseBuild UP-TO-DATE 
:tess-two:tess-two:compileLint 
:tess-two:tess-two:copyReleaseLint UP-TO-DATE 
:tess-two:tess-two:mergeReleaseProguardFiles UP-TO-DATE 
:tess-two:tess-two:preBuild UP-TO-DATE 
:tess-two:tess-two:preReleaseBuild UP-TO-DATE 
:tess-two:tess-two:checkReleaseManifest 
:tess-two:tess-two:prepareReleaseDependencies 
:tess-two:tess-two:compileReleaseAidl UP-TO-DATE 
:tess-two:tess-two:compileReleaseRenderscript UP-TO-DATE 
:tess-two:tess-two:generateReleaseBuildConfig UP-TO-DATE 
:tess-two:tess-two:generateReleaseAssets UP-TO-DATE 
:tess-two:tess-two:mergeReleaseAssets UP-TO-DATE 
:tess-two:tess-two:generateReleaseResValues UP-TO-DATE 
:tess-two:tess-two:generateReleaseResources UP-TO-DATE 
:tess-two:tess-two:packageReleaseResources UP-TO-DATE 
:tess-two:tess-two:processReleaseManifest UP-TO-DATE 
:tess-two:tess-two:processReleaseResources UP-TO-DATE 
:tess-two:tess-two:generateReleaseSources UP-TO-DATE 
:tess-two:tess-two:ndkBuild FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':tess-two:tess-two:ndkBuild'. 
> A problem occurred starting process 'command '/Users/renard/devel/android-ndk-r9c//ndk-build'' 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 7.68 secs 
Executing tasks: [:app:assembleAV5Debug] 

Configuration on demand is an incubating feature. 
Returning version 640 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
Returning version 240 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
Returning version 140 
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. 
signing.properties not found 
:app:preBuild UP-TO-DATE 
:app:preAV5DebugBuild UP-TO-DATE 
:app:checkAV5DebugManifest 
:app:preAV5ReleaseBuild UP-TO-DATE 
:app:preAV7DebugBuild UP-TO-DATE 
:app:preAV7ReleaseBuild UP-TO-DATE 
:app:preX86DebugBuild UP-TO-DATE 
:app:preX86ReleaseBuild UP-TO-DATE 
:tess-two:tess-two:compileLint 
:tess-two:tess-two:copyReleaseLint UP-TO-DATE 
:tess-two:tess-two:mergeReleaseProguardFiles UP-TO-DATE 
:tess-two:tess-two:preBuild UP-TO-DATE 
:tess-two:tess-two:preReleaseBuild UP-TO-DATE 
:tess-two:tess-two:checkReleaseManifest 
:tess-two:tess-two:prepareReleaseDependencies 
:tess-two:tess-two:compileReleaseAidl UP-TO-DATE 
:tess-two:tess-two:compileReleaseRenderscript UP-TO-DATE 
:tess-two:tess-two:generateReleaseBuildConfig UP-TO-DATE 
:tess-two:tess-two:generateReleaseAssets UP-TO-DATE 
:tess-two:tess-two:mergeReleaseAssets UP-TO-DATE 
:tess-two:tess-two:generateReleaseResValues UP-TO-DATE 
:tess-two:tess-two:generateReleaseResources UP-TO-DATE 
:tess-two:tess-two:packageReleaseResources UP-TO-DATE 
:tess-two:tess-two:processReleaseManifest UP-TO-DATE 
:tess-two:tess-two:processReleaseResources UP-TO-DATE 
:tess-two:tess-two:generateReleaseSources UP-TO-DATE 
:tess-two:tess-two:ndkBuild FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':tess-two:tess-two:ndkBuild'. 
> A problem occurred starting process 'command '/Users/renard/devel/android-ndk-r9c//ndk-build'' 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 6.703 secs 

ответ

0

Вы можете использовать этот код.

Drawable d = imageView.getDrawable(); 

    Bitmap bitmap = ((BitmapDrawable) d).getBitmap(); 
    byte[] ba; 
    do { 
     ByteArrayOutputStream bao = new ByteArrayOutputStream(); 

     Log.e("BEFORE REDUCING", 
       bitmap.getHeight() + " " + bitmap.getWidth() + " " 
         + bitmap.getRowBytes() * bitmap.getHeight()); 

     bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bao); 

     ba = bao.toByteArray(); 
     if ((ba.length/1024) >= 650) { 
      bitmap = Bitmap.createScaledBitmap(bitmap, 
        (int) (bitmap.getWidth() * 0.95), 
        (int) (bitmap.getHeight() * 0.95), true); 

     } 

     Log.e("BYTE LENGTH", "" + ba.length/1024); 

    } while ((ba.length/1024) >= 650); 

    String ba1 = Base64.encodeToString(ba, Base64.DEFAULT); 

Этот код преобразует изображения в 64-разрядную строку. Для более по этой ссылке enter link description here

1: how to convert an image into base64 string и enter link description here

+0

как бы я включить это в приложение – april21

+0

, если вы хотите хранить в базе данных по этой ссылке http://stackoverflow.com/questions/21048506/best -method-to-save-retrieve-images-to-database, если вы хотите хранить на сервере, просто используйте («ключ», base^4Image) в json-формате. –