apply plugin: 'com.google.ar.sceneform.plugin' . unable to build [closed] - android

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I'm trying to implement my first sceneform application.
I'm following the following tutorials:
My references:
https://www.youtube.com/playlist?list=PLsOU6EOcj51cEDYpCLK_bzo4qtjOwDWfW
https://developers.google.com/ar/develop/java/quickstart
I'm using the following configurations:
mac os High Sierra - Version 10.13.6 (17G7024)
Android Studio - 3.1.3
My app's gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myfirstapp.example.com.helloar"
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
// Provides ArFragment, and other UX resources.
implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.11.0'
implementation 'com.google.ar:core:1.11.0'
// Alternatively, use ArSceneView without the UX dependency.
implementation 'com.google.ar.sceneform:core:1.11.0'
}
apply plugin: 'com.google.ar.sceneform.plugin'
sceneform.asset('sampledata/ArcticFox_Posed.obj',
'default',
'sampledata/ArcticFox_Posed.sfa',
'src/main/assets/ArcticFox_Posed')
My project's gradle file:
// 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'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.ar.sceneform:plugin:1.11.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My manifest file :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="myfirstapp.example.com.helloar">
<uses-permission android:name="android.permission.CAMERA" />
<!-- "AR Required" apps must declare minSdkVersion ≥ 24 -->
<uses-sdk android:minSdkVersion="24" />
<!-- Indicates that the app requires ARCore ("AR Required"). Ensures the app is
visible only in the Google Play Store on devices that support ARCore.
-->
<uses-feature android:name="android.hardware.camera.ar" />
<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="com.google.ar.core" android:value="required" />
</application>
</manifest>
When I right clicked on .obj file and clicked on import sceneform asset. It's throwing the adding the following to my app's gradle file
apply plugin: 'com.google.ar.sceneform.plugin'
sceneform.asset('sampledata/ArcticFox_Posed.obj',
'default',
'sampledata/ArcticFox_Posed.sfa',
'src/main/assets/ArcticFox_Posed')
Error Given:
Unable to find method 'com.android.build.gradle.api.ApplicationVariant.getMergeResourcesProvider()Lorg/gradle/api/tasks/TaskProvider;'.
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Kindly help with the fix.

I've upgraded my android studio to 3.4.2 and it's working now.

Related

Integrating Mopub with AdMob mediation: Manifest not found error

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"/>

Android - Set up Google Play Services and Firebase - Gradle build error

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).

Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. > java.lang.UnsupportedOperationException (no error message)

I am not sure why this is happening, but I did some digging and tried to find other solutions. None worked out especially duplicate questions:
android {
compileSdkVersion 26
buildToolsVersion "23.0.3"
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
all*.exclude group: 'com.android.support', module: 'support-annotations'
}
defaultConfig {
applicationId "com.myapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':react-native-customized-image-picker')
compile project(':react-native-vector-icons')
compile project(':react-native-restart')
compile project(':react-native-image-picker')
compile project(':react-native-fast-image')
compile project(':lottie-react-native')
compile project(':react-native-fetch-blob')
compile "com.android.support:multidex:1.0.1"
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.fresco:fresco:1.0.1"
compile "com.facebook.fresco:animated-gif:1.0.1"
compile("com.facebook.react:react-native:0.54.0") { force = true } // From node_modules
}
I deleted some duplicate compiles that I found and still no help. I noticed in the trace this warning:
C:\ReactProjects\myapp\android\app\src\main\AndroidManifest.xml:11:5-29:19 Warning:
application#android:theme was tagged at AndroidManifest.xml:11 to replace other declarations but no other declaration present
C:\ReactProjects\myapp\android\app\src\main\AndroidManifest.xml:16:9-19:35 Warning:
meta-data#com.bumptech.glide.integration.okhttp.OkHttpGlideModule was tagged at AndroidManifest.xml:16 to remove other declarations but no other declaration present
I don't know if that will cause this whole thing to fail. Lastly here is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:allowBackup="true"
tools:replace="android:theme"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<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" />
</application>
Every problem that I had when trying to get a successful build I looked on SO or other sources, but this one takes the cake. I never inserted compile "com.android.support:multidex:1.0.1" before and it worked before this problem occurred. Still no success.
The last thing I remembered doing is saving a file called 'safecode.js' in the home directory and basically it just has code that I want to save.
I had the exact same problem and I understand what a headache this can be. Here was my solution:
1) Make sure there are no duplicate dependencies in build.gradle and settings.gradle
2) Most of you might not like this one, but I (hurts to type this) upgraded most things such as:
compileSdkVersion 26 - build.gradle
buildToolsVersion "26.0.1" - build.gradle
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip - settings.gradle
classpath 'com.android.tools.build:gradle:3.1.0' - build.gradle not in app directory
NOTE: Your Command Prompt's build UI will change and it does look overwhelming, but pretty cool. You'll get used to it. Also, you might need to change those compile in build.gradle soon.
Here is the solution for that: Android Studio build.gradle warning message
That should be pretty much it, but I'll also tell you other things I did that might affect your BUILD FAILED:
1) You might need Java 8. JDK 1.8. Add this to build.gradle app directory:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
2) Get rid of compile "com.android.support:multidex:1.0.1"
3) targetSdkVersion 22 update to 26
And lastly,
4) In build.gradle not in app directory, put maven { url 'https://maven.google.com' } in both repos.
NOTE: You could use google() in place of that, but it didn't work for me so I stuck with maven { url 'https://maven.google.com' }.
ALSO TO NOTE: You might get messages saying, "WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0.". Hey, 26 seems to be our magic number, if it works, then don't touch it. Unless you are absolutely certain you need to.
To my knowledge and experience the warnings you get from the build process won't affect your BUILD SUCCESS or BUILD FAILED.
I hope this works for everyone!

Android Studio Error: Execution failed for task ':app:processDebugManifest'

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.

Android Studio 0.9.0 - Cannot resolve symbols

After 6h spent trying to fix this by myself, AS is driving me crazy. Everything was fine yesterday and today it can't resolve any of the support libs nor the R symbols.
I tried everthing, including all the suggested fixes I found on StackOverflow. No need to tell me to have a look a this post, I already have and none of the solutions work.
Here's what I tried so far :
rebuilding / cleaning the project (many times...),
synchronising the project with Gradle Files,
check that the support lib is up-to-date in the SDK Manager,
invalide Caches / restart AS,
delete the .idea folder and the .iml files of my project, and re-importing it in AS,
update AS from 0.8.11 to 0.9,
eventually I ended up uninstalling AS and reinstalling it from scratch
And none of this fixed my issue...
Something really weird is that I also tried to create a whole new project from scratch and to copy/paste all my classes & resources from my corrupted project to this new one. And it worked for a while (~10 min), until it eventually became corrupted the same way, without any apparent reason.
Moreover, no idea if it's relevant, but when I type "ViewPager" in AndroidStudio and hit CTRL-SPACE, it doesn't suggest me the "android.support.v4.view.ViewPager" class. But if I hit CTRL-SPACE 3 times in a row, it DOES suggest it. So I guess that means that it's able to find the support lib somewhere but not to use it?
Here's my build.gradle :
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.mathieumaree.library"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:support-v13:21.0.0'
}
Please, help me, otherwise I'm gonna break my computer soon.
Thanks in advance,
Mathieu
EDIT 1 :
I forgot to mention that this occurs only in one of my projects. The others seem to be fine (at least for now).
EDIT 2 :
I also forgot to mention that my project is composed of an application project plus a library module inside it. So here is the app's build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.mathieumaree.materialheaderviewpager"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library')
compile 'com.android.support:support-v13:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
}
The app Manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mathieumaree.materialheaderviewpager" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.mathieumaree.materialheaderviewpager.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>
The library manifest :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mathieumaree.library">
<application android:allowBackup="true"
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:theme="#style/AppTheme">
</application>
</manifest>
The main settings.gradle :
include ':app', ':library'
And the main build.gradle :
// 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:0.14.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
EDIT 3 :
After trying once more to delete all .idea folers & *.iml files and reloading my project, I noticed that AndroidStudio displayed an error at openning :
Accessing invalid virtual file:
file://C:/Users/Mathieu/AppData/Local/Android/android-studio1/sdk/sources/android-21;
original:582; found:-: Accessing invalid virtual file:
file://C:/Users/Mathieu/AppData/Local/Android/android-studio1/sdk/sources/android-21;
original:582; found:-
I'm pretty sure it means it's looking for the SDK to yet another location (AppData/Local...android-21). What I don't understand is :
there's no SDK folder at this location
the SDK path indicated in the Project Structure is not this one
Any idea what all this means?
try addind this to buid.gradle
compile 'com.android.support:support-v4:21.0.0
and change build tools version to 20.0.0
Also create a whole new project and see if the same errors are still present in that project.
Try "Tools" -> "Android" -> "Sync Project with Gradle Files"
Well, still not a clue what caused this problem but it would look like I managed to get rid of it, although I had to create a new project from scratch. What I really don't understand is that I've already done this yesterday and it didn't work out.

Categories

Resources