小编Far*_*nir的帖子

错误:任务执行失败':app:transformClassesWithMultidexlistForDebug'

在build.gradle中构建具有multiDexEnabled的项目时,我遇到了问题

这是错误

**错误:任务':app:transformClassesWithMultidexlistForDebug'的执行失败.

java.io.IOException:无法读取[APP_PATH/app/build/intermediates/transforms/CLASSES/FULL_PROJECT/jarMerging/debug/classes.jar](无法处理类[i.class](未知验证类型[19] ]在堆栈图框架))**

这是我的gradle文件

apply plugin: 'com.android.application'



android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
useLibrary  'org.apache.http.legacy'

defaultConfig {
    multiDexEnabled true
    applicationId "com.example.application"
    minSdkVersion 11
    targetSdkVersion 23
    versionCode 13
    versionName "2.4"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}


dependencies {
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup:android-times-square:1.6.4@aar'
compile files('libs/IDTUniPaySDK.jar')
compile files('libs/emv-bertlv-0.1.3-shaded.jar')
compile files('libs/audio.jar')
compile files('libs/bluebambooV4.4.jar')
compile 'ch.acra:acra:4.6.2'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.4.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
}
Run Code Online (Sandbox Code Playgroud)

当我删除这两个依赖项(1-compile文件('libs/audio.jar')2-compile文件('libs/bluebambooV4.4.jar'))并删除了使用这2个依赖项的参考代码时,我的项目工作良好.

java android android-studio android-gradle-plugin android-proguard

8
推荐指数
1
解决办法
9389
查看次数

语音识别在android中过早出现

此功能启动语音识别,但它过早地超时,就像从IME键盘(例如谷歌键盘)启动语音识别一样,它不会如此快地超时.我需要一种方法来启动与谷歌键盘使用相同的意图.

public void StartSpeechRecognitionActivity(){
    try{
        Intent intent = new   Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getClass().getPackage().getName());
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
        intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, 3000);
        intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 3000);
        main.startActivityForResult(intent, SPEECHRECOGNITION_RESULTCODE);
    } catch (ActivityNotFoundException error) {
        ShowAndSpeakMessage("Speech recognition is not supported by your device");
    } catch( RuntimeException error ) {
        Log.e( TAG, ERROR_PREFIX + Errors.toString(error) );
    } catch( Error error ) {
        Log.e( TAG, ERROR_PREFIX + Errors.toString(error) );
        throw error;
    }
}
Run Code Online (Sandbox Code Playgroud)

java android

6
推荐指数
1
解决办法
1370
查看次数

操作栏选项卡不填充android中的屏幕

我在一个应用程序中使用支持操作栏并在2个设备中测试Nexus S和Nexus 7,我发现有关标签栏宽度,Nexus S标签栏填充宽度的不同结果,而nexus 7标签栏在左侧留有一些空间.我使用支持操作栏提供的默认主题,应用自定义主题不会影响操作栏,因为父样式必须是Theme.AppCompat.Light

清单中的活动

<activity
    android:name=".MainActivity"
    android:screenOrientation="portrait"
    android:theme="@style/Theme.AppCompat.Light" > 

<android.support.v4.view.ViewPager                                                                                                       
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
Run Code Online (Sandbox Code Playgroud)

类:

public class MainActivity extends ActionBarActivity implements ActionBar.TabListener {

    ActionBar bar;
    ViewPager pager;
    TabsAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        pager = (ViewPager) findViewById(R.id.pager);
        bar = getSupportActionBar();

        adapter = new TabsAdapter(getSupportFragmentManager());

        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        bar.setHomeButtonEnabled(false);

        pager.setAdapter(adapter);
        pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

            @Override
            public void onPageSelected(int position) {
                // When swiping between different app sections, select the
                // corresponding tab.
                // …
Run Code Online (Sandbox Code Playgroud)

tabs android android-layout android-theme android-actionbar

5
推荐指数
1
解决办法
5054
查看次数