标签app_name更改为Android中的库标签

时间:2017-02-06 11:09:29

标签: android label

在我的应用中,我使用aar文件中的库。让我们说library.aar

我的应用程序被调用," Awsome app",所以我有一个字符串值:

<string name="app_name" translatable="false">Awsome app</string>

但是当我编译应用程序时,手机中的名称是&#34; SDK&#34;,此标签来自library.aar

的strings.xml:

<string name="app_name" translatable="false">Awsome App</string>

有没有办法避免库更改我的应用名称?

==编辑==

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="xxx.xxx.AwsomeApp">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:name="xxx.xxx.AwsomeApp"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="DATABASE"
            android:value="app.db" />
        <meta-data
            android:name="VERSION"
            android:value="1" />
        <meta-data
            android:name="QUERY_LOG"
            android:value="false" />
        <meta-data
            android:name="DOMAIN_PACKAGE_NAME"
            android:value="xxx.xxx.AwsomeApp" />

        <activity
            android:name="xxx.xxx.AwsomeApp.MainActivity"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />
        <activity
            android:name="xxx.xxx.AwsomeApp.SplashActivity"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="xxx.xxx.AwsomeApp.LegalActivity"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />
        <activity
            android:name="xxx.xxx.AwsomeApp.LoginActivity"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />
        <activity
            android:name="xxx.xxx.AwsomeApp.QuizActivity"
            android:label="@string/title_activity_quiz" />

        <meta-data
            android:name="io.fabric.ApiKey"
            android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
    </application>

</manifest>

我将gradle文件添加到:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.20.1'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 25
    buildToolsVersion '23.0.3'

    productFlavors{
        vanilla {
            applicationId "xxx.xxx.AwsomeApp"
            buildConfigField 'String','HOST_API', '"awsomeURL"'

        }
        bsa {
            applicationId "xxx.xxx.AwsomeApp.bsa"

            buildConfigField 'String','HOST_API', '"awsomeURL"'
        }
    }

    defaultConfig {
        applicationId "xxx.xxx.AwsomeApp"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 8
        versionName "1.4"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    maven { url "https://jitpack.io" }
    maven { url 'https://maven.fabric.io/public' }
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    androidTestCompile 'com.android.support:support-annotations:25.0.1'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test:rules:0.5'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'

    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'com.github.satyan:sugar:1.4'
    compile 'com.github.PhilJay:MPAndroidChart:v2.1.3'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }
    compile 'com.squareup.okhttp3:okhttp:3.5.0'
    compile 'com.problematiclibrary.sdk:sdk-release@aar'  <<--- here is the libray (I dont put the real name, cause if from work)
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
}

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试将App name直接作为String添加到应用程序标记中。并显示输出。

<application
    android:name="xxx.xxx.AwsomeApp"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="Awsome App"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

尝试这个后告诉我......