Diego
Diego

Reputation: 649

cannot resolve symbol 'chromium'

I am trying to use Trusted Web Activity, following this guide : https://developers.google.com/web/updates/2017/10/using-twa

I did follow all the steps, but there are several words Android Studio cannot resolve by itself and I do not find any solution. The main problem seems to be org.chromium .

In bold the words it can't resolve :

in TwaSessionHelper.java :

import org.chromium.customtabsclient.shared.ServiceConnection;

import org.chromium.customtabsclient.shared.ServiceConnectionCallback;

...

public class TwaSessionHelper implements ServiceConnectionCallback {

...

mConnection = new ServiceConnection(this);

in TwaLauncherActivity.java :

setContentView(R.layout.activity_twa_launcher);

and in the few lines of code :

TwaSessionHelper.TwaSessionCallback twaSessionCallback = mTwaSessionCallback.get();

What am I missing ?

Here is my build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "didi.a8bitpocketwrestlers"
        minSdkVersion 17
        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'
        }
    }
}

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

Upvotes: 1

Views: 1103

Answers (1)

Oleg Sokolov
Oleg Sokolov

Reputation: 1143

Android Studio cannot resolve ServiceConnectionCallback class because a com.android.support:customtabs library does not contain/provide it. This class exists only in this GitHub repository and no any maven repository. So you not able to add a dependency on it in your build.gradle file, you have to download it and add it in your project manually.

From this GitHub repository download only shared directory, add it in your project as a module.

In your application build.gradle file add a dependency on the shared module.

compile project(':shared')

Upvotes: 2

Related Questions