小编kri*_*688的帖子

如何在android应用程序中导入ZXING库?

我需要在我的应用程序中实现ZXING QR代码扫描程序.我有完整的ZXING Android源代码.现在,我想在我的应用程序中使用它.我的问题是,我应该在我的应用程序中复制所有ZXING库代码,包括清单,xml和java文件,或者我可以有一个jar文件,我需要在我的应用程序中添加它?任何人都可以告诉我如何从Android代码创建jar文件,或者任何ZXING jar已经可用,我可以在我的应用程序中包含它?

java android zxing

3
推荐指数
1
解决办法
2万
查看次数

Android:西班牙语:解析浮点值时出现问题:应用程序崩溃

Android:西班牙语:解析浮点值时出现问题:App崩溃步骤:

1.将语言设为app中的西班牙语

2.将一些浮点值格式化为单个小数

3.将格式化的值再次浮动

应用程序崩溃.

示例代码如下:

如果您对此有任何疑问,请帮忙.

 TextView textView = null;
    protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            textView = (TextView) findViewById(R.id.textview);
            float value = 3.456789f;
            setLocale("es", this);//Set App language as Spanish
            String parsedString = String.format("%.1f", value); // format the float value to single precision 
            float parsedValueFloat = Float.parseFloat(parsedString); // parse the value again to float.(APP Crashesh here)
            textView.setText(parsedValueFloat+"");
    }

        public static void setLocale(String languageCode, Context ctx) {
            Locale locale = new Locale(languageCode);
            Locale.setDefault(locale);
            Configuration config = new Configuration();
            config.locale …
Run Code Online (Sandbox Code Playgroud)

android localization

3
推荐指数
1
解决办法
854
查看次数

peer not authenticated:在Android Studio中构建应用程序时出错

我一直在尝试使用fabric.io中的crashlytics构建应用程序.但是,如果提到错误,构建就会失败.

Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources]

Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:classpath'.
   > Could not resolve io.fabric.tools:gradle:1.+.
     Required by:
         TestProject18July2016:app:unspecified
      > Could not resolve io.fabric.tools:gradle:1.+.
         > Failed to list versions for io.fabric.tools:gradle.
            > Unable to load Maven meta-data from https://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml.
               > Could not GET 'https://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml'.
                  > peer not authenticated

* Try:
Run with --stacktrace …
Run Code Online (Sandbox Code Playgroud)

gradle crashlytics android-studio fabric.io

3
推荐指数
1
解决办法
1780
查看次数

如何使用命令行在 Android 测试类中传递参数?

我想要一种将命令行参数发送到我的测试类以运行所有单元测试并从中创建测试覆盖率报告的方法。我使用下面的命令来生成测试覆盖率报告并传递参数

./gradlew createDebugCoverageReport -Dparam=input1  
Run Code Online (Sandbox Code Playgroud)

下面是应用程序 gradle 文件

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 30

    defaultConfig {
        applicationId "com.example.testcoverageapp"
        minSdkVersion 27
        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'
        }
        debug {
            testCoverageEnabled true
        }

    }

    testOptions {
        unitTests.includeAndroidResources = true
        unitTests.all {
            useJUnitPlatform()
            test {
                println systemProperties['param']
                systemProperties(System.getProperties())
            }
        }
    }



    tasks.withType(Test){
        systemProperties=System.properties
        println systemProperties['param.name']
        systemProperty 'param.name', System.getProperty('param')
    }
    
}


dependencies {
    implementation fileTree(dir: …
Run Code Online (Sandbox Code Playgroud)

android gradle android-testing build.gradle android-instrumentation

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