label app_name changes to library label in Android - android

In my app, I use a library from an aar file. lets say library.aar
My app is called, "Awsome app", so I have a string value:
<string name="app_name" translatable="false">Awsome app</string>
But when I compile the app, the name in the mobilephone is "SDK", where this label is from the library.aar
strings.xml:
<string name="app_name" translatable="false">Awsome App</string>
Is there any way to avoid the library change my app name?
== EDIT ==
<?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>
I add the gradle file to:
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'
}

Try to put App name direct as String in application tag. and show the output.
<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">
Let me know after try this...

Related

Why my emulator is throwing me the error, missing system image?

Well, actually, I am a newbie to android. I have been trying to develop an app that has google maps, and everything was going fine until today when I got this error from the emulator.
Here are some files in case it may be helpful.
Manifest XML file:
<?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.example.uaproject">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<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/Theme.UAProject">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".Hotels"
android:exported="true"
android:parentActivityName=".HomeScreen" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />
<activity
android:name=".NoteEditorActivity"
android:exported="true"
android:parentActivityName=".HomeScreen" />
<activity
android:name=".AboutApp"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".Copyrights"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".ToAboutBayanOlgey"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".ToAboutUs"
android:exported="true"
android:parentActivityName=".Menu" />
<activity
android:name=".Menu"
android:exported="true"
android:parentActivityName=".HomeScreen" />
<activity
android:name=".HomeScreen"
android:exported="true" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
build.gradle-app level
plugins {
id 'com.android.application'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.uaproject"
minSdk 19
targetSdk 31
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
}
}
dependencies {
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation 'com.github.smarteist:autoimageslider:1.3.9'
implementation 'com.google.android.material:material:<version>'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
build.gradle-root level
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.1"
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
PS: By the way, if you guys have time, could you please guide me on how to add google maps to an already-created fragment(for example, my fragment is the one of a bottom navigation). I have been searching but all I tried did not work for some reason. Or just a link to the valid way would do because there seemed to be many obsolete approaches to this as well, which we beginners cannot really discern.

on adding targetSDKVersion app is not working

I have a step counter Andriod app, I have to upload it on playstore and it's not working with targetSDKversion defined as playstore needs a API level 29+
and this default API is 28 (Playstore Console told)
this is the /build.gralde file
buildscript {
repositories {
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.4'
if (rootProject.ext.has("gradle_classpath")) {
classpath rootProject.ext.gradle_classpath
} else {
logger.warn('classpath not found in rootProject')
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.google.gms:google-services:4.3.4'
}
}
}
allprojects {
repositories {
jcenter()
maven{url "https://jitpack.io"}
google()
mavenCentral()
}
}
apply plugin: 'com.android.application'
android {
if (rootProject.ext.has("compileSdkVersion")) {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
} else {
logger.warn('compileSdkVersion not found in rootProject')
compileSdkVersion = 30
buildToolsVersion = "30.0.3"
}
defaultConfig {
applicationId "com.j4velin.pedometer"
minSdkVersion 21
multiDexEnabled true
}
flavorDimensions "main"
productFlavors {
fdroid {
dimension "main"
}
}
lintOptions{
disable 'MissingTranslation'
disable 'ExtraTranslation'
}
buildTypes {
release {
signingConfig signingConfigs.release
zipAlignEnabled true
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
debug {
debuggable true
signingConfig signingConfigs.release
zipAlignEnabled true
minifyEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 30
buildToolsVersion '30.0.3'
}
repositories {
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.github.j4velin.colorpicker:colorpicker:1.20.6'
implementation 'com.github.j4velin.EazeGraph:EazeGraph:1.0.3'
implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.github.Shashank02051997:FancyToast-Android:0.1.8'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation platform('com.google.firebase:firebase-bom:26.3.0')
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.firebase:firebase-database:19.6.0'
playImplementation 'com.google.android.gms:play-services-identity:17.0.0'
implementation 'org.jsoup:jsoup:1.10.2'
implementation 'com.ogaclejapan.smarttablayout:library:2.0.0#aar'
implementation 'com.ogaclejapan.smarttablayout:utils-v4:2.0.0#aar'
}
apply plugin: 'com.google.gms.google-services'
This is working and app is working fine and counting steps
but when I add targetSDKVersion
defaultConfig {
applicationId "com.j4velin.pedometer"
minSdkVersion 21
multiDexEnabled true
targetSdkVersion 30 //APP STOPS COUNTING STEPS
}
This is my AndroidManifest file
<?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.shubham.pedo"
android:versionCode="1"
android:versionName="1.0.0">
<uses-feature
android:name="android.hardware.sensor.stepcounter"
android:required="true" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION"/>
<uses-permission android:name="android.permission.WAKE_LOCK" android:maxSdkVersion="30" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.DeviceDefault.Light.DarkActionBar"
tools:replace="label">
<activity
android:name=".AboutActivity"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
android:exported="true"/>
<activity
android:name=".PEDOMETER.Google_Sign_In"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light"/>
<receiver android:name=".PEDOMETER.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name=".PEDOMETER.AppUpdatedReceiver">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<service android:name=".PEDOMETER.SensorListener" />
<service
android:name=".PEDOMETER.widget.DashClock"
android:permission="com.google.android.apps.dashclock.permission.READ_EXTENSION_DATA">
<intent-filter>
<action android:name="com.google.android.apps.dashclock.Extension" />
</intent-filter>
<meta-data
android:name="protocolVersion"
android:value="2" />
<meta-data
android:name="worldReadable"
android:value="true" />
<meta-data
android:name="description"
android:value="Displays the steps taken today" />
</service>
<activity
android:name=".PEDOMETER.widget.WidgetConfig"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Holo.Dialog.NoActionBar">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<receiver android:name=".PEDOMETER.widget.Widget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget" />
</receiver>
<service
android:name=".PEDOMETER.widget.WidgetUpdateService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>
</manifest>
Everything is working fine without adding targetSDKVersion, with adding this playstore accepts release apk but that stops counting the steps of User

Android Studio Sync fails due "failure to parse XML in AndroidManifest.xml"

I decided to update an old app, sadly when I try to sync the project I'm getting the following Gradle Sync error:
"ERROR: Failed to parse XML in C:...\app\src\main\AndroidManifest.xml
ParseError at [row,col]:[17,9]
Message: expected start or end tag
Affected Modules: app"
After doing my research and forums, the problem seems to be in the AndroidManifest (duh!) when I go to the line 17 I find the Meta-data of my app, and if I add some lines before this, the error moves accordingly to the line.
I have also updated the Gradle to 4.10.1, the Android Plugin version is 3.3.1; and I'm using the "Default Gradle Wrapper"
Here is the Manifest Code
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myPackage">
<application
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="#drawable/gordotoken"
android:label="#string/app_name"
android:roundIcon="#drawable/gordotoken"
android:supportsRtl="true"
android:theme="#style/AppTheme">
///META DATA
<meta-data
android:name="com.google.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"/>
<activity
android:name="myPackage.MainActivity"
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="myPackage.dvd" />
<activity android:name="myPackage.dvai" />
<activity android:name="myPackage.dvaicat" />
<activity android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
<activity android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<provider android:authorities="com.facebook.app.FacebookContentProvider{xxx}"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
Here is the build.gradle for the app
apply plugin: 'com.android.application'
android {
signingConfigs {
configRelease {
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('C:MyKey.jks')
storePassword 'xxx'
}
}
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
applicationId 'myApp'
minSdkVersion 27
targetSdkVersion 27
versionCode 17
versionName "1.14"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.configRelease
}
}
productFlavors {
}
}
dependencies {
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation ('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:mediarouter-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android:flexbox:0.2.5'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.github.bumptech.glide:glide:4.3.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services:11.8.0'
implementation 'com.google.android.gms:play-services-games:11.8.0'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
}
apply plugin: 'com.google.gms.google-services'
Here is the build.gradle for the project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'll appreciate if someone could point me in the right direction as I seem to be missing some tags in my manifest and at this point I don;t know what I'm doing wrong here :(
Thank you all before hand for your help! :)
Remove below line from your manifest.xml file
///META DATA
And replace it with below comments syntax
<!—- META DATA —->
As pointed out here already to comment in XML we shouldn't be using /// but <!-- > instead.
Please replace /// META DATA with <!-- META DATA-> and that should work.
If you want to make comment in xml file, you need to use <!--your comment here--> this tag. // or /**/ doesn't work
I also faced the same issue, where removing the comments from
//this is a comment
to
<!--this is a comment-->
worked for me.

app:transformClassesWithJarMergingForDebug, com.android.build.api.transform.TransformException: java.util.zip.ZipException:

First of all I know there are many similar question, but my case is different. Please read the full question first!
This is the full error...
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/firebase/appindexing/Action$Builder$StatusType.class
Whenever I am trying to run in my emulator this error is showing.
Also if I try to generate .apk file (in debug or released mode), the same error is showing.
Now the magic...
If I run in my mobile phone in debug mode, it is totally ok. No errors are showing, it is running fine.
This is my manifest file...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.brandtechnosolutions.petbaazar">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#drawable/iconpetbazar"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat.Light">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information.
-->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".LoginActivity"
android:label="#string/title_activity_login"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" />
<activity android:name=".WebActivity" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:screenOrientation="portrait" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<activity
android:name=".BuyerSellerActivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".OptionActivity"
android:label="#string/title_activity_option"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".TakeAdInfoActivity"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"/>
</application>
</manifest>
My build.gradle...
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
dexOptions {
javaMaxHeapSize "1g"
}
repositories {
mavenCentral()
}
defaultConfig {
applicationId "com.brandtechnosolutions.petbaazar"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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'
})
// apply plugin: 'com.google.gms.google-services'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:support-v4:25.1.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'junit:junit:4.12'
}
Using sdk platforms...
Gingerbread, Honeycomb, Marshmallow
Using emulator with Jelly Bean.
Anybody has any idea how to solve it, please help!
You should use the same level of libraries:
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-appindexing:10.0.1'
Also add at the buttom of the file:
apply plugin: 'com.google.gms.google-services'
EDIT:
To use the plugin you have to add the dependency in the buildscript block (in your top-level file or module file):
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
// ...
}

ClassDefNoFound on API 22 x_86 level API

I am facing a strange problem in API level 22 (lollipop) mobiles.
Mobiles using these API levels are working fine
API 24
API 23
But when i run my app on API level 22 mobile, it gives me following error message.
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.squareup.picasso.Picasso"
on path: DexPathList[[zip file
"/data/app/com.myapp.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp.app-1/lib/x86, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
However this is not Picasso related problem, if i remove Picasso library it starts giving me error messages on other classes.
Process: com.myapp.app, PID: 16327
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/myapp/app/VideosListActivity
at com.myapp.app.MainActivity$8.onClick(MainActivity.java:422)
Gradle FIles (App)
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId 'com.myapp.app'
minSdkVersion 21
targetSdkVersion 24
versionCode 26
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}
}
lintOptions {
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g"
jumboMode true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':common')
compile project(':commonwidget')
compile project(':videowidget')
compile 'com.android.support:multidex:1.0.1'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.okhttp:logging-interceptor:2.6.0'
compile 'org.glassfish:javax.annotation:10.0-b28'
compile 'io.card:android-sdk:5.4.0'
compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'
compile 'com.github.michaelye.easydialog:easydialog:1.4'
compile 'org.jsoup:jsoup:1.8.3'
compile 'me.grantland:autofittextview:0.2.+'
repositories {
flatDir {
dirs 'libs'
}
}
Gradle - Project
buildscript {
repositories {
jcenter()
}
dependencies {
/**/
/* classpath 'com.android.tools.build:gradle:1.2.3'*/
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.gms:google-services:2.1.0'
classpath 'com.google.code.gson:gson:2.2.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application
android:name=".AnalyticsSampleApp"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<service android:name=".ticketing.services.LogoutService" />
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".SplashDefaultActivity" />
</activity>
<activity
android:name=".DirectionsActivity"
android:label="#string/title_activity_directions"
android:parentActivityName=".MapsActivity"
android:theme="#style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".SplashDefaultActivity" />
</activity>
<activity
android:name=".SplashDefaultActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SplashVideoActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".VideosListActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/title_activity_videos_list"
android:screenOrientation="portrait"
android:theme="#style/AppTheme" />
<activity
android:name=".VideoActivity"
android:configChanges="orientation|screenSize"
android:label="#string/title_activity_video"
android:theme="#style/AppTheme" />
Did you manually re-sync gradle after your changes? Did you also change build-tools version in your build.gradle to match API 22 as well? The errors you're showing I've only seen when gradle hasn't rebuilt or resynced properly. I would also try to manually do it from the command line... (in OS X), ./gradlew clean, ./gradlew assemble

Categories

Resources