I'm facing an issue while assembling a library project. I had built an application project & later on converted it to library. I'm not able to generate .aar package. I found few answers here that tells to change the apt neenbedankt plugin, attaching databinding:compiler, but that didn't worked for me at all. Some might say that dagger is the issue but i'm not sure of it. Please help.
Here is my error log while assembling a build
Information:Gradle tasks [assemble]
/home/***/***/**/**/productlisting/viewmodel/ProductListFragmentViewModel.java
Error:(9, 52) error: cannot find symbol class BR
/home/***/***/**/**/home/viewmodel/NavSubItemViewModel.java
Error:(3, 52) error: cannot find symbol class BR
/home/***/***/**/**/productlisting/viewmodel/NavSubItemViewModel.java
Error:(3, 52) error: cannot find symbol class BR
/home/***/***/**/**/home/topbrands/BrandActivityViewModel.java
Error:(3, 52) error: cannot find symbol class BR
/home/***/***/**/**/productlisting/viewmodel/ProductListActivityViewModel.java
Error:(3, 52) error: cannot find symbol class BR
/home/***/***/**/**/home/viewmodel/NewArrivalViewModel.java
Error:(3, 52) error: cannot find symbol class BR
/home/***/***/**/**/home/viewmodel/NavParentItemViewModel.java
Error:(3, 52) error: cannot find symbol class BR
/home/***/***/**/**/productlisting/viewmodel/NavParentItemViewModel.java
Error:(3, 52) error: cannot find symbol class BR
Error:Execution failed for task :app:compileLiveDebugJavaWithJavac.
Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 6.519 secs
Information:9 errors
Information:0 warnings
Information:See complete output in console
Here is my module level build.gradle
``
apply plugin: 'com.android.library'
apply plugin: 'io.fabric' def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName getCurrentVersion()
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [hostNameDeepLink: "http://***.**.in:203/api/"]
buildConfigField "String", "CodeRevision", "\"{$gitSha}\""
multiDexEnabled true
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
testOptions {
unitTests.returnDefaultValues = true
}
packagingOptions {
pickFirst 'META-INF/rxjava.properties'
}
signingConfigs {
planet {
storeFile file('../****.jks')
storePassword '***#123'
keyAlias '***'
keyPassword '***#123'
}
}
dataBinding {
enabled = true
}
lintOptions {
disable 'InvalidPackage'
abortOnError false
}
dexOptions {
jumboMode true
}
productFlavors {
local {
String WebServiceUrl = getWebServiceUrl()
String WebSitePath = getWebSitePath()
String ImageUrl = getImageUrl()
String ServerName = getServerName()
String TestCustomerId = getWebSitePath()
buildConfigField "String", "WebServiceUrl", "\"$WebServiceUrl\""
buildConfigField "String", "WebSitePath", "\"$WebSitePath\""
buildConfigField "String", "ImageUrl", "\"$ImageUrl\""
buildConfigField "String", "ServerName", "\"$ServerName\""
buildConfigField "String", "TestCustomerId", "\"$TestCustomerId\""
manifestPlaceholders = [hostNameDeepLink: "http://10.160.0.18"]
}
live {
String WebServiceUrl = getWebServiceUrl()
String WebSitePath = getWebSitePath()
String ImageUrl = getImageUrl()
String ServerName = getServerName()
String TestCustomerId = getWebSitePath()
buildConfigField "String", "WebServiceUrl", "\"$WebServiceUrl\""
buildConfigField "String", "WebSitePath", "\"$WebSitePath\""
buildConfigField "String", "ImageUrl", "\"$ImageUrl\""
buildConfigField "String", "ServerName", "\"$ServerName\""
buildConfigField "String", "TestCustomerId", "\"$TestCustomerId\""
/*buildConfigField "String", "WebServiceUrl", "\"http://perfectmother.zoomi.in:203/api/\""
buildConfigField "String", "WebSitePath", "\"http://perfectmother.zoomi.in:203/\""
buildConfigField "String", "ImageUrl", "\"http://perfectmother.zoomi.in:203\""
buildConfigField "String", "ServerName", "\"-Live\""
buildConfigField "String", "TestCustomerId", "\"10086\""*/
manifestPlaceholders = [hostNameDeepLink: "http://perfectmother.zoomi.in"]
}
}
buildTypes {
release {
signingConfig signingConfigs.planet
shrinkResources true
minifyEnabled true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
}
debug {
signingConfig signingConfigs.planet
debuggable true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro'
}
}
}
def static getCurrentVersion() {
def buildEnv = System.getenv("BUILD_NUMBER")
def buildNumber = buildEnv != null ? ".${buildEnv}" : ""
return "1.0" + buildNumber
}
def getWebServiceUrl() {
return hasProperty('WebServiceUrl') ? WebServiceUrl : ''
}
def getWebSitePath() {
return hasProperty('WebSitePath') ? WebSitePath : ''
}
def getImageUrl() {
return hasProperty('ImageUrl') ? ImageUrl : ''
}
def getServerName() {
return hasProperty('ServerName') ? ServerName : ''
}
def getTestCustomerId() {
return hasProperty('TestCustomerId') ? TestCustomerId : ''
}
ext {
playServiceVersion = '10.2.1'
supportLibVersion = '25.3.1'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:$supportLibVersion"
// Unit testing
testCompile 'org.robolectric:robolectric-resources:3.0'
testCompile 'org.robolectric:shadows-core:3.2.2'
testCompile 'org.robolectric:robolectric:3.2.2'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.6.3'
//Hamcrest
testCompile 'org.hamcrest:hamcrest-all:1.3'
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'
//Zoomi library
compile 'com.zoomi.android:utils:1.0'
compile 'com.zoomi.android:rxutils:1.5.1'
//CardView:
compile "com.android.support:cardview-v7:$supportLibVersion"
//RecyclerView:
compile "com.android.support:recyclerview-v7:$supportLibVersion"
//Design
compile "com.android.support:design:$supportLibVersion"
//Glide
compile 'com.github.bumptech.glide:glide:3.7.0'
//Dagger
compile 'com.google.dagger:dagger:2.9'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
//Auto Value
annotationProcessor 'com.google.auto.value:auto-value:1.3'
provided 'com.google.auto.value:auto-value:1.3'
//Auto Value GSON
annotationProcessor 'com.ryanharter.auto.value:auto-value-gson:0.4.6'
provided 'com.ryanharter.auto.value:auto-value-gson:0.4.6'
//Auto Value Parcelable
annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
provided 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
//Rx
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
//Timber
compile 'com.jakewharton.timber:timber:4.3.1'
//FOR CI
compile "com.google.firebase:firebase-core:$playServiceVersion"
//Fire base crash reporting
compile "com.google.firebase:firebase-crash:$playServiceVersion"
//Fire base authentication
compile "com.google.firebase:firebase-auth:$playServiceVersion"
compile "com.google.android.gms:play-services-auth:$playServiceVersion"
//bottom bar
compile 'com.aurelhubert:ahbottomnavigation:2.0.4'
//Groupie
compile 'com.genius:groupie:0.8.0'
//PageIndicator
compile 'com.romandanylyk:pageindicatorview:0.1.1'
//FiftyShadesOf
compile 'com.github.florent37:fiftyshadesof:1.0.0'
//Proguard Snippets
compile 'com.github.PrashamTrivedi:ProguardSnips:0.1-snapshot'
//ProGuard rules for RxJava!
compile 'com.artemzin.rxjava:proguard-rules:1.2.4.0'
//Facebook
compile 'com.facebook.android:facebook-android-sdk:4.19.0'
//Twitter
compile('com.twitter.sdk.android:twitter:2.3.1#aar') {
transitive = true
}
// Crop image
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
//Show case
compile 'com.github.deano2390:MaterialShowcaseView:1.1.0'
//GSON
compile 'com.google.code.gson:gson:2.8.0'
//Constraint layout
compile 'com.android.support.constraint:constraint-layout:1.0.2'
//Firebase cloud messaging
compile 'com.google.firebase:firebase-messaging:10.2.0'
}
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
classpath 'io.fabric.tools:gradle:1.22.1'
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
maven { url 'http://**.***.**.**:81/release/' }
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
}
apply plugin: 'com.google.gms.google-services'
Related
FAILURE: Build failed with an exception.
What went wrong:
Project 'app' not found in root project 'MobileBuy'.
getting above error when I build project. but in my android project no app folder then why this Project 'app' not found in root project 'MobileBuy' getting this error.
settings.gradle
include ':sample', ':buy3', ':buy3-pay-support', ':graphql-java-support'
project(':graphql-java-support').projectDir = new File('./libs/graphql_java_gen/support')
build.gradle
buildscript {
dependencies {
classpath dep.androidPlugin
classpath dep.retrolambda
classpath dep.butterknifePlugin
classpath dep.apolloPlugin
}
}
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.apollographql.android'
android {
compileSdkVersion androidConfig.compileSdkVersion
buildToolsVersion androidConfig.buildToolsVersion
defaultConfig {
applicationId "com.shopify.sample"
minSdkVersion androidConfig.minSdkVersion
targetSdkVersion androidConfig.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
all {
buildConfigField 'okhttp3.logging.HttpLoggingInterceptor.Level', 'OKHTTP_LOG_LEVEL', 'okhttp3.logging.HttpLoggingInterceptor.Level.BODY'
// We pull the shop settings either from the Environment or a file called shop.properties at the root of the project.
// Environment variables will take precedence, we will attempt to read those first.
def shopDomain
def apiKey
def androidPayPublicKey
def androidPayEnvironment
// get the shop setting from the environment if there any
shopDomain = System.getenv("SHOP_DOMAIN")
apiKey = System.getenv("API_KEY")
androidPayPublicKey = System.getenv("ANDROID_PAY_PUBLIC_KEY")
androidPayEnvironment = System.getenv("ANDROID_PAY_ENVIRONMENT")
// pull the store properties from the local file if it exists. Environment variables take precedence
def shopProperties = new Properties();
File shopPropertiesFile = project.file('shop.properties')
if (shopPropertiesFile.exists()) {
shopProperties.load(new FileInputStream(shopPropertiesFile))
shopDomain = shopDomain ?: shopProperties["SHOP_DOMAIN"]
apiKey = apiKey ?: shopProperties["API_KEY"]
androidPayPublicKey = androidPayPublicKey ?: shopProperties["ANDROID_PAY_PUBLIC_KEY"]
androidPayEnvironment = androidPayEnvironment ?: shopProperties["ANDROID_PAY_ENVIRONMENT"]
}
if (!shopDomain) {
shopDomain = ""
}
if (!apiKey) {
apiKey = ""
}
if (!androidPayPublicKey) {
androidPayPublicKey = ""
}
if (!androidPayEnvironment) {
androidPayEnvironment = "com.google.android.gms.wallet.WalletConstants.ENVIRONMENT_SANDBOX"
}
buildConfigField "String", "SHOP_DOMAIN", "\"" + shopDomain.toString() + "\""
buildConfigField "String", "API_KEY", "\"" + apiKey.toString() + "\""
buildConfigField "String", "ANDROID_PAY_PUBLIC_KEY", "\"" + androidPayPublicKey.toString() + "\""
buildConfigField "int", "ANDROID_PAY_ENVIRONMENT", androidPayEnvironment
debuggable = true
minifyEnabled = false
}
}
productFlavors {
shopify {
}
xApollo {
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile dep.androidSupportDesign
compile dep.androidSupportV4
compile dep.androidSupportV7
compile dep.androidSupportAnnotations
compile dep.rxAndroid
compile dep.rxJava
compile dep.timber
compile dep.butterKnife
compile 'com.ss.bannerslider:bannerslider:1.8.0'
compile 'com.ss.bottomnavigation:bottomnavigation:1.5.2'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.apmem.tools:layouts:1.10#aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
annotationProcessor dep.butterKnifeCompiler
compile(dep.fresco) {
exclude group: 'com.android.support'
}
compile dep.constraintLayout
compile dep.rxrelay
compile dep.archRuntime
compile dep.archExt
annotationProcessor dep.arcCompiler
compile project(':buy3-pay-support')
shopifyCompile project(':buy3')
xApolloCompile dep.apolloRuntime
xApolloCompile dep.okhttpLogging
xApolloCompile dep.apolloHttpCache
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.xiaofeng.android:flowlayoutmanager:1.2.3.2'
compile 'com.beloo.widget:ChipsLayoutManager:0.3.7#aar'
}
task downloadApolloSchema(type: DefaultTask, group: "GraphQL", description: "Download GraphQL store front API schema") {
doLast {
println("Downloading GraphQL schema...")
def schemaFile = new File(project.projectDir.absolutePath + '/src/xApollo/graphql/com/shopify/sample/domain/schema.json')
if (schemaFile.exists()) {
schemaFile.delete()
}
new URL('https://app.shopify.com/services/ping/storefront_graphql_schema').withInputStream { i ->
schemaFile.withOutputStream {
it << i
}
}
println("GraphQL schema has been downloaded!")
}
}
apollo {
customTypeMapping['URL'] = "String"
customTypeMapping['HTML'] = "String"
customTypeMapping['Money'] = "java.math.BigDecimal"
nullableValueType = "apolloOptional"
generateAccessors = false
useSemanticNaming = false
}
I am not able to build release APK. Every time I get DexMergerException.
Here are my build.gradles:
I am using MVVM structure. I have core(package name for core is same as my app package) has my lib where I only write view models, models and network layers.
Errors I am getting:
Caused by: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Caused by: com.android.tools.r8.utils.AbortException
Program type already present:
app build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
signingConfigs {
debug {
storeFile file(DEBUG_STORE_FILE)
}
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
v2SigningEnabled false
}
}
compileSdkVersion 27
flavorDimensions "default"
defaultConfig {
applicationId "com.puma.one8crew"
minSdkVersion 21
targetSdkVersion 27
vectorDrawables.useSupportLibrary = true
versionCode 1
multiDexEnabled true
versionName "1.0"
resValue 'string', 'facebook_app_id', FACEBOOK_APP_ID_DEV
resValue 'string', 'fb_login_protocol_scheme', FACEBOOK_LOGIN_PROTOCOL_SCHEME
manifestPlaceholders += [
FACEBOOK_APP_ID_BGY: FACEBOOK_APP_ID_DEV,
FB_LOGIN_SCHEME : FACEBOOK_LOGIN_PROTOCOL_SCHEME
]
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled = true
}
buildTypes {
debug {
minifyEnabled false
signingConfig signingConfigs.debug
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
/* productFlavors {
prod {
resValue 'string', 'facebook_app_id', FACEBOOK_APP_ID_DEV
resValue 'string', 'fb_login_protocol_scheme', FACEBOOK_LOGIN_PROTOCOL_SCHEME
}
stage {
resValue 'string', 'facebook_app_id', FACEBOOK_APP_ID_DEV
resValue 'string', 'fb_login_protocol_scheme', FACEBOOK_LOGIN_PROTOCOL_SCHEME
}
}*/
applicationVariants.all { variant ->
variant.outputs.all { output ->
def project = "one8crew"
outputFileName = "${project}_${variant.buildType.name}_${variant.versionName}.apk"
}
}
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
preDexLibraries = true //delete the already predexed libraries
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':core')
implementation 'com.android.support:animated-vector-drawable:27.0.1'
implementation 'com.android.support:customtabs:27.0.1'
implementation 'com.android.support:cardview-v7:27.0.1'
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
implementation 'com.android.support:recyclerview-v7:27.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.android.support:support-v4:27.0.1'
implementation 'com.android.support:design:27.0.1'
implementation 'com.android.support:support-v13:27.0.1'
implementation 'com.alimuzaffar.lib:pinentryedittext:1.3.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
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'
//Dependencies for LifeCycle Android ViewModel
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation project(':com.wowza.gocoder.sdk')
implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
//support design lib dependency fot tab
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1#aar') {
transitive = true;
}
}
Below is my core build.gradle and I have also updated the same version for all lib.
core build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
repositories {
flatDir {
dirs 'libs'
}
jcenter()
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
compileOnly 'com.wowza.gocoder.sdk.android:com.wowza.gocoder.sdk:1.0b7#aar'
// compile 'android.arch.lifecycle:extensions:1.1.1'
implementation 'com.google.dagger:dagger:2.11'
api('com.squareup.retrofit2:retrofit:2.1.0') {
exclude module: 'okhttp'
}
api 'com.google.code.gson:gson:2.8.1'
api 'com.squareup.retrofit2:converter-gson:2.3.0'
api 'swarajsaaj:otpreader:1.1'
api 'com.github.bumptech.glide:glide:4.3.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
//Dependencies for LifeCycle Android ViewModel
implementation 'android.arch.lifecycle:extensions:1.1.1'
// annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
compileOnly project(':com.wowza.gocoder.sdk')
compile project(':libraries:horizontalcalendar')
compile project(':libraries:calendarview')
//Library for setting fonts
api 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.android.support:multidex:1.0.3'
}
I tried so many time and I am not able to understand the reason behind this issue.
Same happened today to me and this is what solved the issue:
Find all the dependencies of com.google.android.gms:play-services.
They all have now different versions. Just place the mouse over them and correct the version numbers (i.e. for me was upgrading maps from 15.0.0 to 15.0.2 and tag-manager to 15.0.1)
I have some troubles compiling my project with Gradle 3. When I update my project to use this version of Gradle, the gradle sync is okay, but as soon as I hit the run button, it gives me this:
Error:Execution failed for task
':app:compileBetaGoogleWebkitDebuggableReleaseJavaWithJavac'.
> java.lang.NoClassDefFoundError: com/fyber/annotations/FyberSDK
With older gradle (2.3.3) it works just perfect, but I need to update the project, for undisclosable, professional reason. What can go wrong between those two gradle versions, that one sees the FyberSDK and the other does not?
Here is my gradle script
apply plugin: 'com.android.application'
def mVersionCode = 16;
def mVersionName = "1.16"
android {
signingConfigs {
releaseSigning {
keyAlias 'redacted'
keyPassword 'redacted'
storeFile file('redacted')
storePassword 'redacted'
}
}
compileSdkVersion 23
defaultConfig {
applicationId "redacted"
minSdkVersion 19
targetSdkVersion 23
versionCode mVersionCode
versionName mVersionName
resValue "string", "app_version_name", mVersionName
resValue "string", "app_name", "redacted"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseSigning
}
debuggableRelease {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseSigning
}
}
flavorDimensions "server", "lib"
productFlavors {
pubGoogle {
dimension "server"
minSdkVersion 19
buildConfigField("boolean", "isGoogleBuild", "true")
}
betaGoogle {
dimension "server"
minSdkVersion 14
resValue "string", "app_version_name", mVersionName + "beta"
resValue "string", "app_name", "redacted Beta"
buildConfigField("boolean", "isGoogleBuild", "true")
}
pubAmazon {
dimension "server"
minSdkVersion 19
buildConfigField("boolean", "isGoogleBuild", "false")
}
betaAmazon {
dimension "server"
minSdkVersion 14
resValue "string", "app_version_name", mVersionName + "beta"
resValue "string", "app_name", "redacted Beta"
buildConfigField("boolean", "isGoogleBuild", "false")
}
/*xwalk {
dimension "lib"
}*/
webkit {
dimension "lib"
}
}
}
repositories {
mavenCentral()
maven {
name "Fyber's maven repo"
url "https://fyber.bintray.com/maven"
}
}
configurations {
provided
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.sponsorpay:sponsorpay-android-sdk:7.2.8'
compile 'com.fyber:fyber-sdk:8.17.0'
// Fyber Annotations
provided 'com.fyber:fyber-annotations:1.3.0'
annotationProcessor 'com.fyber:fyber-annotations-compiler:1.4.0'
// Fyber mediation services
// UnityAds Mediation
compile 'com.fyber.mediation:unityads:2.1.1-r1#aar'
// ChartBoost Mediation
compile 'com.fyber.mediation:chartboost:6.6.3-r2#aar'
// Vungle Mediation
compile 'com.fyber.mediation:vungle:5.3.0-r1#aar'
// Vungle third-party dependencies
compile 'com.google.dagger:dagger:2.7'
compile 'javax.inject:javax.inject:1'
compile 'de.greenrobot:eventbus:2.2.1'
compile 'io.reactivex:rxjava:1.2.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.okio:okio:1.11.0'
compile 'com.google.android.gms:play-services-basement:11.0.1'
compile 'com.google.android.gms:play-services-location:11.0.1'
// For AppsFlyer
compile 'com.appsflyer:af-android-sdk:4.6.0#aar'
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.android.gms:play-services-gcm:11.0.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
//xwalkCompile 'org.xwalk:xwalk_core_library:23.53.589.4'
}
apply plugin: 'com.google.gms.google-services'
I also encountered this problem, eventually solved the problem.
you maybe use a annotations like this:
#FyberSDK
all you need to is find this annotations ,and change it's build.gradle file with this:
apply plugin: 'com.android.library'
android {
// ...
// add this code to enable annotationProcessor
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
}
dependencies {
// ...
// Fyber Annotations
compileOnly 'com.fyber:fyber-annotations:1.3.0'
annotationProcessor 'com.fyber:fyber-annotations-compiler:1.4.0'
// ...
}
try this code ,and sync your project.hope is work fine, it's work fine for me.
if you want learn more for detail, you can read my blog here:
https://segmentfault.com/a/1190000012245056
I'm unable to run the project in Canary 6 and Canary 7.
Gradle build succeeded.
At compile time it didn't show any errors.
At runtime its showing errors with all library classes(gradle dependency, jar dependency).
Some of them are,
error: package retrofit2 does not exist
error: package android.support.v7.app does not exist
error: package com.google.gson does not exist.
Error: Note: #BindView field with unresolved type (PercentRelativeLayout) must elsewhere be generated as a View or interface.
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
top build.gradle:
// 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.0.0-alpha7'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
core build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
minSdkVersion 15
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
implementation 'com.android.support:percent:26.0.0-beta2'
implementation "com.android.support:support-core-utils:26.0.0-beta2"
implementation 'com.squareup.retrofit2:retrofit:2.0.2'
implementation 'com.squareup.picasso:picasso:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.2.0'
implementation 'com.intuit.sdp:sdp-android:1.0.3'
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'com.google.code.gson:gson:2.2.4'
implementation 'com.android.support:design:26.0.0-beta2'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
app build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.msf.phillip"
minSdkVersion 15
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'
}
}
flavorDimensions "uat"
productFlavors {
fullUAT {
dimension "uat"
versionName "1.37.2.0"
resValue 'string', 'APP_NAME', '"Poems SG 2.0"'
buildConfigField "String", "VERSION", "\"1.2.2.0\""
buildConfigField "String", "connection_env", "\"uat\""
buildConfigField "String", "connection_url", "*******"
buildConfigField "String", "API_KEY", "************"
buildConfigField "boolean", "mandatoryUpdate", "false"
buildConfigField "String", "FLURRY_API_KEY", "*************"
}
fullRelease {
dimension "uat"
versionName "1.0.4.0"
resValue 'string', 'APP_NAME', '"Poems"'
buildConfigField "boolean", "isUAT", "false"
buildConfigField "boolean", "isInternal", "false"
buildConfigField "String", "VERSION", "\"1.0.0\""
buildConfigField "String", "connection_env", "\"prod\""
buildConfigField "String", "connection_url", "*************"
buildConfigField "String", "API_KEY", "**************"
buildConfigField "boolean", "mandatoryUpdate", "false"
buildConfigField "String", "FLURRY_API_KEY", "************"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(path: ':core')
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
implementation 'com.google.android.gms:play-services-gcm:11.0.2'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.flurry.android:analytics:7.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
implementation 'com.jakewharton:butterknife:8.6.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
I'm trying to add map fragment to activity. For my example I use this official article:https://developers.google.com/maps/documentation/android-api/
But after opening activity with map fragment, my app immediately closed. In logs I have errors like this:
"E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.mw.a"
My gradle:
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "....."
minSdkVersion 14
targetSdkVersion 23
versionCode VERSION_CODE
versionName VERSION_NAME
}
signingConfigs {
debug {
storeFile file("keys/debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release {
}
}
buildTypes {
debug {
minifyEnabled false
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
lintOptions {
// If true, stop the gradle build if errors are found.
abortOnError false
htmlReport true
disable "RtlHardcoded", "RtlSymmetry", "RtlEnabled", "RelativeOverlap"
disable 'InvalidPackage'
}
def APK_NAME = PROJECT_NAME + "-" + VERSION_NAME + ".apk"
applicationVariants.all { variant ->
variant.outputs.each { output ->
if (variant.buildType.name.equals("debug")) {
output.outputFile = new File(output.outputFile.parent, output.outputFile.name.replace("app-debug.apk", APK_NAME))
} else {
output.outputFile = new File(output.outputFile.parent, output.outputFile.name.replace("app-release.apk", APK_NAME))
}
}
}
}
File propFile = file('signing.properties');
if (propFile.exists()) {
def Properties props = new Properties()
props.load(new FileInputStream(propFile))
if (props.containsKey('RELEASE_STORE_FILE') && props.containsKey('RELEASE_STORE_PASSWORD') &&
props.containsKey('RELEASE_KEY_ALIAS') && props.containsKey('RELEASE_KEY_PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['RELEASE_STORE_FILE'])
android.signingConfigs.release.storePassword = props['RELEASE_STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['RELEASE_KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['RELEASE_KEY_PASSWORD']
} else {
android.buildTypes.release.signingConfig = null
}
} else {
android.buildTypes.release.signingConfig = null
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okio:okio:1.6.0'
compile 'com.google.code.gson:gson:2.3'
compile 'org.parceler:parceler:0.2.15'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.pixplicity.easyprefs:library:1.7'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.borax12.materialdaterangepicker:library:1.2'
compile 'io.realm:realm-android:0.84.1'
compile 'com.cocosw:bottomsheet:1.1.1#aar'
compile 'io.socket:socket.io-client:0.6.1'
}
After that, I add multidex possibility according to
Getting error: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza, but it does not resolve the problem.
What can be a problem?
Your targetSdkVersion is 23 and the AppsOpsManager is available in API 19 and above. What you are missing is to add compile 'com.android.support:multidex:1.0.0' or multiDexEnabled true in the build.gradle file in order to enable the multidex function.