1

Recently I was forced to do a fresh install of Ubuntu. I had copied all my AndroidStudio projects that I was creating in the tutorial, to a flash drive and added them to the the new OS setup. On both systems they were/are in a dir/ AndroidStudioProjects.

Maybe installing Android Studio on the new OS gave me a new version of it. The current version I am using is 4.1.1 I've worked through a couple of problems but this one is stumping me. I'm not seeing any help on Google threads that is pointing me in the right direction.

Here is my MainActivity.kt file:

package com.johndcowan.cardviewlayout

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.main_layout)
    }
}

The class section is all underlined with the red-squiggly line. The error, when I hover, is:

Cannot access 'android.app.Activity' which is a supertype of 'com.johndcowan.cardviewlayout.MainActivity'. Check your module classpath for missing or conflicting dependencies

When I hover over the Bundle line, I get this error:

value-parameter savedInstanceState: [ERROR : Bundle]?

I noticed that in the configure Android SDK, I see the Android SDK location is:

/home/jdc44/Android/Sdk

I'm assuming this is correct. That path exists with subdirectories, but it does not point to any specific file. (??)

Zoe
  • 27,060
  • 21
  • 118
  • 148
John Cowan
  • 1,452
  • 5
  • 25
  • 39
  • Do you have the android jar in the `sdk/platorms/android-version`? – akhil nair Dec 09 '20 at 21:47
  • Thanks for replying. What is the full path to ... sdk/platforms/android-version? I do not know where to look to see that. Sorry! – John Cowan Dec 10 '20 at 00:08
  • I think this fixed it for me. I found this thread in StackOverFlow: https://stackoverflow.com/questions/34353220/how-do-i-select-android-sdk-in-android-studio answer #439. Menu: File >> Sync Project with Gradle Files. app is working again. Yay! – John Cowan Dec 10 '20 at 00:19
  • Just so you know, any time you make a change in your ``build.gradle`` files, you have to sync it - it pops up a little "sync now" option at the top, you pretty much always want to hit that! – cactustictacs Dec 10 '20 at 11:45

1 Answers1

0

When you start a new project check the legacy android.support libraries checkbox. and thats it :)