0
votes

Consider:

buildscript {

    repositories {
        apply plugin: 'announce'
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        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()
        maven{ url "https://jitpack.io"}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App Gradle (maybe here is the cause of error)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "chocolahat.softeng.sweetbitescafe"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.+'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    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'

    // My Library
    implementation 'com.google.firebase:firebase-core:11.6.2'

    implementation 'com.google.firebase:firebase-database:11.6.2'

    implementation 'com.android.support:cardview-v7:26.+'

    implementation 'com.android.support:recyclerview-v7:26.+'

    implementation 'com.squareup.picasso:picasso:2.5.2'

    implementation 'com.firebaseui:firebase-ui-database:3.1.2'

    implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'

    implementation 'com.android.support:design:26.+'

    implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'

    implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'

    implementation 'com.google.android.gms:play-services-location:11.6.2'

    implementation 'com.github.mancj:MaterialSearchBar:0.7.1'

    implementation 'com.github.d-max:spots-dialog:0.7@aar'

}
apply plugin: 'com.google.gms.google-services'

ERROR (unfortunately the application has stopped)

E/AndroidRuntime: FATAL EXCEPTION: main Process: chocolahat.softeng.sweetbitescafe, PID: 26876 java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/chocolahat.softeng.sweetbitescafe-2/split_lib_dependencies_apk.apk) at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119) at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208) at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:110) at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38) at android.support.v7.widget.AppCompatTextView.(AppCompatTextView.java:81) at android.support.v7.widget.AppCompatTextView.(AppCompatTextView.java:71) at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103) at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024) at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725) at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:414) at android.view.LayoutInflater.inflate(LayoutInflater.java:365) at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) at chocolahat.softeng.sweetbitescafe.MainActivity.onCreate(MainActivity.java:18) at android.app.Activity.performCreate(Activity.java:6092) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2481) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2608) at android.app.ActivityThread.access$800(ActivityThread.java:178) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5637) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)

the MainActivity.java:18 line code is this setContentView(R.layout.activity_main);

How can I solve this?

1
defined or declared any custom font attributes ? - Sush
appears that you are using a custom text view and font path that you gave is invalid. - Jainam Jhaveri
then what should i do? - Marjun Cerezo
please post your custom view code - Jainam Jhaveri
Any solution to this ? - Miljan Rakita

1 Answers

0
votes

API level 26 has come up with its default font attribute. And the same font attribute might have been defined in code as part of the custom font attribute.

Solution: change your custom font attribute name.

Like font to custom_font and use in XML files as custom_font:

The same changes will be applied in your Java code as well.