Android Studio Canary 2.4 errors - android

I have update Android Studio to the new Canary version, and I updated my gradle file. When I launch my app through run, I get the following error:
Process: io.github.siddharthvenu.saltanalysis, PID: 23244
java.lang.SecurityException: Signature check failed for io.github.siddharthvenu.saltanalysis
at android.os.Parcel.readException(Parcel.java:1915)
at android.os.Parcel.readException(Parcel.java:1861)
at com.google.android.gms.common.internal.zzv$zza$zza.zza(Unknown Source:41)
at com.google.android.gms.common.internal.zzf.zza(Unknown Source:0)
at com.google.android.gms.internal.zzzf$zzc.zzxQ(Unknown Source:0)
at com.google.android.gms.internal.zzzf$zzf.run(Unknown Source:0)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.android.gms.internal.zzabx.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
Edit: I found that the above error is caused due to AdView of Android. Somehow including ads in my app makes it crash.
I thought this was maybe because I didn't sign the apk, so I signed it (debug), and then tried to install it using adb install command. I got the following output:
Failed to install alpha_test_006.apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]
My AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.github.siddharthvenu.saltanalysis">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="#mipmap/ic_material_chemical"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="AllowBackup">
<activity android:name=".HomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".RadicalListActivity"
android:parentActivityName=".HomeActivity"
android:theme="#style/AppTheme.TranslucentActionBar"
android:screenOrientation="sensorPortrait"
tools:targetApi="jelly_bean" />
<activity
android:name=".DisplayRadicalActivity"
android:parentActivityName=".RadicalListActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
tools:targetApi="jelly_bean" />
<activity
android:name=".GroupSeparationActivity"
android:parentActivityName=".HomeActivity"
android:screenOrientation="sensorLandscape"
tools:targetApi="jelly_bean" />
<activity
android:name=".LongProcedureActivity"
android:label="Long Procedure"
tools:targetApi="jelly_bean"/>
</application>
</manifest>
My build.gradle:app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-O'
buildToolsVersion '26.0.0-rc1'
def versionPropsFile = file('version.properties')
def code = 1
if (versionPropsFile.canRead()) {
Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
List<String> runTasks = gradle.startParameter.getTaskNames();
def value = 0
for (String item : runTasks)
if (item.contains("assembleRelease")) {
value = 1
}
code = versionProps['VERSION_CODE'].toInteger() + value
versionProps['VERSION_CODE'] = code.toString()
versionProps.store(versionPropsFile.newWriter(), null)
defaultConfig {
applicationId "io.github.siddharthvenu.saltanalysis"
minSdkVersion 15
targetSdkVersion 'O'
versionCode code
versionName "1.0 Alpha"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
} else {
throw new FileNotFoundException("Could not read version.properties!")
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig getSigningConfig()
def str_ver
if ((int) (code / 100) != 0) {
str_ver = String.valueOf(code)
} else if ((int) (code / 10) != 0) {
str_ver = "0" + String.valueOf(code)
} else {
str_ver = "00" + String.valueOf(code)
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(output.outputFile.parent,
output.outputFile.name.replace(output.outputFile.name, "alpha_test_" + str_ver + ".apk")
)
}
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
compile 'com.jaredrummler:material-spinner:1.1.0'
compile 'com.google.code.findbugs:jsr305:2.0.1'
testCompile 'junit:junit:4.12'
compile files('libs/YouTubeAndroidPlayerApi.jar')
}
apply plugin: 'com.google.gms.google-services'

I found out the reason for the SecurityException generated in the first case. It was due to including an AdViewin my code. I tried to comment it out, and it worked. I suspected this because only activities which contained the AdView's crashed.
The adb install issue still persists though

Related

Have three errors relate to expecting an element and unresolved references

[related code for error in MainActivity.kt][2]
I have tried fn+option+return(Mac IOS) for import purpose, but still not working. Same as trying invalidate caches and restart. They are not working!
I just follow the lecture which is given by the professor step by step. The version for the Android studio on my macbook is 3.5.1
Looking for help.
I also met another error. Here is the code for the AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.assignment3muyaozhang0882423" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:value="#integer/google_play_services_version" />
<activity android:name=".Floating_label" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" >
</activity>
</application>
</manifest>
The error I met which is sync error:
ERROR: Failed to parse XML in /Users/kitty/Downloads/Assignment2MuyaoZhang0882423/app/src/main/AndroidManifest.xml
org.xml.sax.SAXParseException; systemId: file:/Users/kitty/Downloads/Assignment2MuyaoZhang0882423/app/src/main/AndroidManifest.xml; lineNumber: 23; columnNumber: 4; 元素类型 "manifest" 必须由匹配的结束标记 "" 终止。
Affected Modules: app
The code for app:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.assignment3muyaozhang0882423"
minSdkVersion 14
targetSdkVersion 29
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 = kotlin_version
targetCompatibility = kotlin_version
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.android.support:design:29.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
code for kt file:
package com.example.assignment3muyaozhang0882423
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.R
import android.widget.Toast
import android.widget.Toast.LENGTH_LONG
import android.widget.Toast.makeText
class setion2 : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_setion2)
val usernamestring = text_Person_Name.text
val passwordstring = text_Password.text
val con_btn = (Button) findViewById(R.id.con_btn) as Button
con_btn.isAllCaps = false
con_btn.setOnClickListener {
if (this.usernamestring.isNotEmpty() && this.passwordstring.isNotEmpty())
{
val message =
"User Name: " + usernamestring + "\n" + "Password: " + this.passwordstring
Toast.makeText(this, message, LENGTH_LONG).show()
} else {
Toast.makeText(this, "Please enter valid input", LENGTH_LONG).show()
}
}
}
}
Please check out my reply on your comment too.
Click on the error of text_layout and send the relevant code.
It is LinearLayout.LayoutParams.MATCH_PARENT
the underscore is missing between MATCH and PARENT

Manifest merger failed with multiple errors123

When I try to rebuild project, android studio gives the error: I couldn't solve this problem for 2 days please help. What changes should I make?
``Execution failed for task ':app:processDebugManifest'.
I tried all solutions provided for similar problems like this one:
enter link description here
enter link description here
my build gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
//the compression of webp file during build causes problem with FileDescriptor in ContentProvider.
aaptOptions {
noCompress "webp"
}
signingConfigs {
signing_config {
keyAlias 'abc'
keyPassword '123'
}
}
compileSdkVersion 28
defaultConfig {
applicationId "com.whatsapp.fenerstickers"
minSdkVersion 18
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
def contentProviderAuthority = applicationId + ".stickercontentprovider"
// Creates a placeholder property to use in the manifest.
manifestPlaceholders =
[
onesignal_app_id: 'XXXXXXX',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
[contentProviderAuthority: contentProviderAuthority]
// Adds a new field for the authority to the BuildConfig class.
buildConfigField("String",
"CONTENT_PROVIDER_AUTHORITY",
"\"${contentProviderAuthority}\"")
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
task checkDebug {
doLast {
println("checkDebug")
if (android.defaultConfig.applicationId.startsWith("com.whatsapp")) {
throw new GradleException("applicationId in defaultConfig cannot start with com.whatsapp, please change your applicationId in app/build.gradle");
}
checkApplicationIdInDebug()
}
}
private void checkApplicationIdInDebug() {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ignoreApplicationIdCheck = properties.getProperty('ignoreApplicationIdCheck')
if (ignoreApplicationIdCheck == null) {
} else {
println("application id check ignored")
}
}
task checkRelease {
doLast {
println("checkRelease")
if (android.defaultConfig.applicationId.startsWith("com.example")) {
throw new GradleException("applicationId in defaultConfig cannot start with com.example, please change your applicationId in app/build.gradle");
}
}
}
tasks.whenTaskAdded { task ->
println(task.name)
if (task.name.contains("assembleDebug")) {
task.dependsOn checkDebug
}
if (task.name.contains("assembleRelease")) {
task.dependsOn checkRelease
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.fresco:fresco:1.10.0'
implementation 'com.facebook.fresco:webpsupport:1.10.0'
implementation 'com.facebook.fresco:animated-webp:1.10.0'
implementation 'com.facebook.fresco:webpsupport:1.10.0'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.google.firebase:firebase-ads:11.8.0'
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
}
my manifests
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.main.berk">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<application
android:allowBackup="false"
android:fullBackupContent="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".EntryActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".StickerPackListActivity"
android:label="#string/title_activity_sticker_packs_list" />
<activity
android:name=".StickerPackDetailsActivity"
android:parentActivityName=".StickerPackListActivity"
tools:ignore="UnusedAttribute">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.main.berk.StickerPackListActivity" />
</activity>
<activity
android:name=".StickerPackInfoActivity"
android:label="#string/title_activity_sticker_pack_info"
android:parentActivityName=".StickerPackDetailsActivity"
tools:ignore="UnusedAttribute">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.main.berk.StickerPackDetailsActivity" />
</activity>
<provider
android:name=".StickerContentProvider"
android:authorities="${contentProviderAuthority}"
android:enabled="true"
android:exported="true"
android:readPermission="com.whatsapp.sticker.READ" />
</application>
</manifest>
Merging Errors:
Error: Attribute provider#com.main.berk.StickerContentProvider#authorities at AndroidManifest.xml:48:13-62 requires a placeholder substitution but no value for <contentProviderAuthority> is provided. app main manifest (this file), line 47 Error: Validation failed, exiting app main manifest (this file)
You just need to combine multiple array of manifestPlaceholders in one like this
manifestPlaceholders =
[
// WhatsApp Placeholder
contentProviderAuthority: contentProviderAuthority,
onesignal_app_id: 'XXXXXXX',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]

Google Play services error Execution failed for task ':transformClassesWithJarMergingForRelease'

Im trying to implement Google play services into my game. Also, im using AdInCube plugin., which works fine, but now i have two AndroidManifest files. Maybe thats the problem? I already fixed one error (https://github.com/playgameservices/play-games-plugin-for-unity/issues/2028) by reimporting package and force resolve. After this, i cant build my game. I got an error:
What went wrong:
Execution failed for task ':transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/
GoogleServices Manifest:
<?xml version="1.0" encoding="utf-8"?>
<!-- This file was automatically generated by the Google Play Games plugin for Unity
Do not edit. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.example.games.mainlibproj"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application>
<!-- The space in these forces it to be interpreted as a string vs. int -->
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="\u003402577249840" />
<!-- Keep track of which plugin is being used -->
<meta-data android:name="com.google.android.gms.games.unityVersion"
android:value="\u0030.9.53" />
<activity android:name="com.google.games.bridge.NativeBridgeActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
</application>
</manifest>
AdInCube Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.****.snake.101"
android:installLocation="preferExternal"
android:versionCode="9"
android:versionName="1.1.7">
<uses-permission android:name="com.android.vending.BILLING" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<application
android:name="android.support.multidex.MultiDexApplication"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/UnityThemeSelector">
<activity
android:name="com.unity3d.player.UnityPlayerActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="unityplayer.UnityActivity"
android:value="true" />
</activity>
</application>
</manifest>
Gradle:
buildscript {
repositories {
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.application'
repositories {
maven {
url 'https://maven.google.com'
}
maven {
url 'http://repository.adincube.com/maven'
}
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.adincube.sdk:AdinCube-Unity-3626ebe:2.3.1#aar') {
transitive = true
}
compile 'com.android.support:multidex:1.0.1'
**DEPS**
}
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
defaultConfig {
targetSdkVersion '28'
minSdkVersion 14
multiDexEnabled true
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress '.unity3d', '.ress', '.resource', '.obb'
}
**SIGN**
buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
jniDebuggable true
}
release {
minifyEnabled **MINIFY_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
**SIGNCONFIG**
}
}
packagingOptions {
exclude 'lib/armeabi/libadcolony.so'
exclude 'lib/armeabi/libjs.so'
exclude 'lib/arm64-v8a/libadcolony.so'
exclude 'lib/arm64-v8a/libjs.so'
exclude 'lib/x86_64/libadcolony.so'
exclude 'lib/x86_64/libjs.so'
}
}
dependencies {
compile ('com.adincube.sdk:AdinCube-Unity-3626ebe:2.+#aar') {
transitive = true
}
compile 'com.android.support:multidex:1.0.1'
}
repositories {
maven {
url 'https://maven.google.com'
}
maven {
url 'http://repository.adincube.com/maven'
}
jcenter()
}
android {
defaultConfig {
multiDexEnabled true
}
}
android {
packagingOptions {
exclude 'lib/armeabi/libadcolony.so'
exclude 'lib/armeabi/libjs.so'
exclude 'lib/arm64-v8a/libadcolony.so'
exclude 'lib/arm64-v8a/libjs.so'
exclude 'lib/x86_64/libadcolony.so'
exclude 'lib/x86_64/libjs.so'
}
}

I/CrashlyticsCore: Crashlytics report upload complete but not show in dashboard

I have problem with Fabric. its a test project for find problem and do everything step by step in fabric documents, but i don't know what is mistake. please help me.
My Gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.mycompany.testtt"
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compile('com.crashlytics.sdk.android:crashlytics:2.9.4#aar') {
transitive = true;
}
}
My Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.testtt">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="9fd0b323bad2f5dae063288c94fd3a2317faa104"
/>
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Main Activity:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
// TODO: Move this to where you establish a user session
logUser();
setContentView(R.layout.activity_main);
}
private void logUser() {
// TODO: Use the current user's information
// You can call any combination of these three methods
Crashlytics.setUserIdentifier("12345");
Crashlytics.setUserEmail("user#fabric.io");
Crashlytics.setUserName("Test User");
}
public void forceCrash(View view) {
throw new RuntimeException("This is a crash");
}
After all, and error and testing, but nothing is still displayed on the dashboard.
I do everything step by step from fabric documents.
I have this problem for a few days, and anyway I've tested it, but I still have not gotten a result and does not display anything in the fabric dashboard. ApiKey is correct and I'm sure of it.
(sorry for English)

What will Toast display when I use productFlavors in build.gradle?

I've created following project in Android Studio, and clicked on "Run" button in Android Studio to run the app.
In my mind, Android Studio will run the app with debug model, but what will Toast display? will it display the one of following options?
A: com.example.my.myapplication FLAVOR free
B: com.example.my.myapplication FLAVOR pro
C: info.dodata.messagecleanup FLAVOR free
D: info.dodata.messagecleanup FLAVOR pro
MainActivity.java
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String versionName = getPackageName()+" FLAVOR "+BuildConfig.FLAVOR;
if (BuildConfig.FLAVOR == "pro") {
Toast.makeText(getApplicationContext(), versionName, Toast.LENGTH_LONG).show();
}else{
Toast.makeText(getApplicationContext(), versionName , Toast.LENGTH_LONG).show();
}
}
}
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.my.myapplication"
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
productFlavors {
free {
applicationId "info.dodata.messagecleanup"
}
pro {
applicationId "info.dodata.messagecleanup.pro"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.my.myapplication" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Categories

Resources