zoukankan      html  css  js  c++  java
  • Android 讯飞开放平台 语音听写

    一https://www.xfyun.cn/  讯飞开放平台  下载语音听写SDK

    二.导入 语音听写demo

    2.1.speechDemo 导jar包 

    2.2.AndroidManifest.xml  Manifest中添加权限

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.iflytek.voicedemo"
        android:versionCode="1"
        android:versionName="2.0.1018.1013">
    
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.RECORD_AUDIO" />
        <uses-permission android:name="android.permission.CAMERA" />
        <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    

    2.3. build.gradle  

    plugins {
        id 'com.android.application'
    }
    
    android {
        compileSdkVersion 30
        buildToolsVersion "30.0.3"
    
        defaultConfig {
            applicationId "com.iflytek.voicedemo"
            minSdkVersion 22
            targetSdkVersion 30
            versionCode 1
            versionName "1.0"
    
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        
        sourceSets {
            main {
                jniLibs.srcDirs = ['libs']
            }
        }
    }
    
    dependencies {
    
        implementation 'androidx.appcompat:appcompat:1.2.0'
        implementation 'com.google.android.material:material:1.2.1'
        implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
        implementation files('libs\Msc.jar')
        implementation 'androidx.legacy:legacy-support-v4:1.0.0'
        implementation 'com.google.android.material:material:1.4.0'
        testImplementation 'junit:junit:4.+'
        androidTestImplementation 'androidx.test.ext:junit:1.1.2'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    }
    

    2.4. gradle.properties

    android.injected.testOnly=false

    使用AS自动运行时会在appuildoutputsapkdebug文件夹下自动生成测试APK:app-debug.apk,

    用命令adb install app-debug.apk时报错:Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

    解决办法:

    1. 添加-t参数: 输入命令adb install -t app-debug.apk

    2. 在gradle.properties(项目根目录或者gradle全局配置目录 ~/.gradle/)文件中添加:

    android.injected.testOnly=false
    产生原因:

    Android Studio 3.0会在debug apk的manifest文件application标签里自动添加 android:testOnly="true"属性

      

      

  • 相关阅读:
    幸福必读
    JAVA程序员之路
    编写数据库操作类,使ASP.NET 中的数据库操作变得简单
    Duwamish 7.0 系列分析文章
    Visual Studio .NET加密技术剖析系列课程
    做为一个Tester,你为Testing付出了多少?
    程序员分成几种不同的境界
    深度探索C++对象模型(2).txt
    Eclipse快速上手指南之使用JUnit
    Eclipse使用技巧
  • 原文地址:https://www.cnblogs.com/crushgirl/p/15245848.html
Copyright © 2011-2022 走看看