当前位置: 代码迷 >> java >> 图像到文本的Android应用
  详细解决方案

图像到文本的Android应用

热度:107   发布时间:2023-07-16 17:38:07.0

尝试在GitHub上使用TextFairy代码创建一个将图像转换为文本作为其功能之一的android应用:( ),但是它抛出此错误:请帮助! 或建议一些其他图像以文本api / 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

您可以使用此代码。

    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位字符串。 有关更多信息,请点击此链接,

: 并

  相关解决方案