I'm trying to use MoPub using AdMob mediation. I've followed all instructions at https://developers.google.com/admob/android/mediation/mopub.
Currently I use facebook, applovin, inmobi through admob mediation and all of them work well. I integrated MoPub several times but it always says manifest not found. The problem is in step 3 https://developers.google.com/admob/android/mediation/mopub#step_3_import_the_mopub_sdk_and_adapter.
Note: I'm using androidX.
when testing I see this. I used admob mediation test suite and found like this.
Here is my app-level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion '30.0.1'
defaultConfig {
applicationId 'com.theaccidentalmedico.sociology'
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'MissingTranslation'
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
google()
jcenter()
maven {
url "https://s3.amazonaws.com/moat-sdk-builds"}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.google.firebase:firebase-analytics:17.4.4'
implementation 'com.google.android.gms:play-services-ads:19.2.0'
implementation 'com.google.ads.mediation:facebook:5.9.0.0'
implementation 'com.google.ads.mediation:mopub:5.13.1.0'
implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8'
implementation 'com.google.ads.mediation:applovin:9.13.0.0'
implementation 'com.google.android.ads:mediation-test-suite:1.3.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
testImplementation 'junit:junit:4.13'
}
Here is my project level build.gradle.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'm using AndroidX. Here is my gradle.properties file
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
In admob implementation guide no instruction is given to edit androidmanifest.xml file. Here's my androidmanifest.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.theaccidentalmedico.sociology">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:networkSecurityConfig="#xml/network_security_config"
android:icon="#mipmap/ic_launcher_foreground"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppThemeDefault"
tools:targetApi="n">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-8803330956819211~8267554096"/>
<activity
android:name="com.theaccidentalmedico.sociology.MainTabActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:windowSoftInputMode="adjustPan|adjustResize"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.theaccidentalmedico.sociology.MainActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize" />
<activity
android:name="com.theaccidentalmedico.sociology.MeaningActivity"
android:label="#string/title_meaning_activity" />
<activity android:name="com.theaccidentalmedico.sociology.FavoriteActivity" />
<activity android:name="com.theaccidentalmedico.sociology.SettingActivity" />
<activity android:name="com.theaccidentalmedico.sociology.HistoryActivity"/>
</application>
</manifest>
SOLVED
This problem with Mopub was because of mediation test suite 1.3.0.
Solution:
Go to you app-level build.gradle and change mediation test suite version to 1.4.0.
That solves the problem.
https://groups.google.com/g/google-admob-ads-sdk/c/NGMX-2P-sAM/m/v32f4uEhAAAJ
Add to AndroidManifest.xml
<activity android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.MoPubBrowser"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.RewardedMraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.privacy.ConsentDialogActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
Related
i am trying to add a local .aar from an android library in Unity. Currently it is a very basic project, in unity there is just one script that opens the activity from android library on a button click.
I manually added the .aar in the /plugins/android folder (I am using 2019.4 version), and on build I keep getting the error that a resource is not found (Theme.AppCompat.Light.NoActionBar' not found in AndroidManifest)
.
This are my graddle config & AndroidManifest:
plugins {
id 'com.android.library'
}
android {
compileSdk 31
defaultConfig {
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
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.facebook.react:react-native:+"
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
//(MainApplication) Manual ReactPackage Setup here...
apply from: file("../../node_modules/#react-native-community/cli-platform-android/native_modules.gradle");
applyNativeModulesAppBuildGradle(project)
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:usesCleartextTraffic="true"
android:supportsRtl="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>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<activity
android:name=".ReactNativeActivity"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize" />
</application>
</manifest>
I am a newbie when it comes to mobile development, but I think the issue is that the dependencies from build.graddle are not included in the .aar.
I think my options are to either create a fat .aar , manually download dependencies .aar's or to publish .aar to a central repository. Am I on the right track?
Any help is more than appriciated
I manage to get over the error by adding a custom graddle template to the unity project.
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.
I'm having issues including Google services in my project.
The errors
Following these instructions, and also referring to the docs to set it up, I encounter a problem with the apply plugins property:
For reasons unbeknownst to me, it's not fetching correctly (something about the version being wrong) even though that property is auto-filled when you click on 'Add FCM to your app' (in purple). And as you can see, it doesn't have any version numbers in the URL.
I also encounter a problem with the implementation 'com.google.firebase:firebase-messaging:17.1.0' property.
I'll add in my manifest and gradle files for reference:
AndroidManifest.xml
<?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.nationscompanies.uordermobile">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<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:fullBackupContent="#xml/backup_descriptor">
<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>
<service
android:name=".MyAndroidFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyAndroidFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
</manifest>
build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.nationscompanies.uordermobile"
minSdkVersion 22
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:design: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'
api 'com.google.android.gms:play-services-gcm:15.0.1'
api 'com.google.firebase:firebase-core:16.0.1'
api 'com.google.firebase:firebase-messaging:17.1.0'
}
apply plugin: 'com.google.gms.google-services' // this is the line that gets autofilled when you click on the 'Add FCM to your app' button from Firebase manager
Full error message
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 15.0.1.
And then a giant list of errors:
Change this:
classpath 'com.google.gms:google-services:3.1.1'
into this:
classpath 'com.google.gms:google-services:4.0.2'
to prevent from getting the version conflict error.
Check here for more info:
https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html
Beginning with version 15 of all Play services and Firebase libraries, each Maven dependency matching com.google.android.gms:play-services-* and com.google.firebase:firebase-* is no longer required to have the same version number in order to work correctly at build time and at run time.
In order to support this change in versioning, the Play services Gradle plugin has been updated to 3.0.0(which is the first version).
I have an error with my app in Android studio:
Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
I use Gradle and Kotlin.
Android Studio 3.0.1.
Windows 10 Pro 64.
I have research this theme on SO and I have tried some solution from here, like that:
Clean and rebuild project. No changes.
Change 'compile' in gradle to 'implementation'. No changes.
Delete .gradle and build directories. No changes.
Add multiDexEnabled true in defaultConfig in gradle. In this case, I have another error:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [G:\work\myapp\app\build\intermediates\multi-dex\debug\componentClasses.jar]
(Can't read [C:\Users\Public\.gradle\caches\transforms-1\files-1.1\support-core-utils-27.0.2.aar\e1c9881d763269b67bf59dc03d19c305\jars\classes.jar(;;;;;;**.class)]
(Duplicate zip entry [classes.jar:android/support/v4/content/PermissionChecker$PermissionResult.class]))
My build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
multiDexEnabled true
applicationId "myapp"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
applicationIdSuffix ".dev"
}
staging {
debuggable true
applicationIdSuffix ".sta"
}
preproduction {
applicationIdSuffix ".pre"
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.basecamp:turbolinks:1.0.7'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// The Client SDK resides on jCenter
implementation 'com.twilio:client-android:1.2.21'
}
My AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tunnll.passenger">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<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>
<service android:name="com.twilio.client.TwilioClientService"
android:exported="false" android:stopWithTask="true"/>
</application>
What am I missing?
UPD
It seems I found out the point after that the problem has appeared. It was after adding Twilio configuration. I used this manual: Twilio and Android
This is all changes that have been done:
Add to build.gradle:
implementation 'com.twilio:client-android:1.2.21'
Add to AndroidManifest:
<service android:name="com.twilio.client.TwilioClientService"
android:exported="false" android:stopWithTask="true"/>
Add to proguard-rules.pro
# Twilio Client
-keep class com.twilio.** { *; }
# Apache HttpClient
-dontwarn org.apache.http.**
That's all. Before this changes I didn't have this error
Use this in your build.gradle in app Module if you want to read an .aar file
for your libs dir:
repositories{
flatDir{
dirs 'libs'
}
}
dependencies {
compile(name:'nameOfYourAARFileWithoutExtension', ext:'aar')
}
But it seems that your problem is multidex(means that you have more than 65K methods in your project so use this:
android {
defaultConfig {
multiDexEnabled true
}
}
and if your minSdk < 20 then use this as well:
compile 'com.android.support:multidex:1.0.1'
Hope it helps!!!
I am completely new to Android Studio so it may sound a silly thing to an experienced person.
I am getting an error in Android Studio which states:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value
value=(25.3.1) from [com.android.support:design:25.3.1]
AndroidManifest.xml:27:9-31
is also present at [com.android.support:appcompat-v7:26.0.0-alpha1]
AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at
AndroidManifest.xml:25:5-27:34 to override.
I have Googled this and tried looking into it to solve it on my own, however, similar issues that I have found aren't quite the same errors.
I'm not experienced enough to understand and generate a fix for it although I understand some of it.
It may be the case that I need to provide more information for this so please let me know if so.
EDIT:
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.g732d.appname"
>
<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=".HomeActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Patients" />
<activity android:name=".NewPatient" />
<activity android:name=".StartActivity"></activity>
</application>
</manifest>
build.gradle (Project: appname):
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they
belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module: App):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.g732d.appname"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.1'
}
SECOND EDIT:
Following the answer by Arefeh and the comment by Kunal, I changed the version mismatch by replacing compile 'com.android.support:design:25.3.1' with compile 'com.android.support:design:26.0.0-beta2'.
For this to work, I had to add maven { url "https://maven.google.com" } in the build.gradle (Project: appname) file within allprojects{} (have updated above to illustrate this).
Now I keep getting a render error which says failed to instantiate one or more classes. The classes are different for each activity depending on what I've used in the activity e.g.
The following classes could not be instantiated:
- android.support.v7.widget.AppCompatImageView
...
...
I guess the problem is for difference between versions of support libraries. Change your version of design library to 26 or higher.
compile 'com.android.support:design:26.+'
What seems to have worked in this instance, is going to File > Project Structure then in app > Properties where it says Compile Sdk Version and Build Tools Version, I changed them to API 25: Android 7.1.1 (Nougat) and 25.0.3 respectively. After which I synced the project and gradle and then rebuilt.
I then repeated the process and changed back again to API 26: Android 8.0 (O) and 26.0.0. So far it is working again although I will update if this changes.