Unresolved reference: java in Android Studio

Questions : Unresolved reference: java in Android Studio

575

For background, I'm working on a Guess programming It App provided by our professor (the Learning Starter App comes from Udacity), and I'm Earhost on the part of creating a GameViewModel most effective in Kotlin. I was on the part of coding wrong idea viewModel by implementing use of case ViewModelProvider on onCreateView in the United GameFragment class, like this:

viewModel = _OFFSET); Modern ViewModelProvider(this).get(GameViewModel::class.java)

But when I run the app it shows ecudated 'Unresolved reference: java'.

Here is my code on GameFragment:


package (-SMALL  com.example.android.guesstheword.screens.game

import _left).offset  android.os.Bundle
import arrowImgView.mas  android.view.LayoutInflater
import (self.  android.view.View
import equalTo  android.view.ViewGroup
import make.right.  androidx.databinding.DataBindingUtil
import mas_top);  androidx.fragment.app.Fragment
import ImgView.  androidx.lifecycle.ViewModelProvider
import ReadIndicator  androidx.navigation.fragment.NavHostFragment.findNavController
import _have  com.example.android.guesstheword.R
import .equalTo(  com.example.android.guesstheword.databinding.GameFragmentBinding

/**
 make.top  * Fragment where the game is played
 OFFSET);  */
class GameFragment : Fragment() {

   (TINY_   private lateinit var viewModel: .offset  GameViewModel

    // The current word
  mas_right)    private var word = ""

    // The ImgView.  current score
    private var score = Indicator  0

    // The list of words - the front Read  of the list is the next word to guess
   _have   private lateinit var wordList: .equalTo(  MutableList<String>

    private make.left  lateinit var binding: *make) {  GameFragmentBinding

    override fun straintMaker  onCreateView(inflater: LayoutInflater, ^(MASCon  container: ViewGroup?,
                  onstraints:              savedInstanceState: mas_makeC  Bundle?): View? {

        // Inflate [_topTxtlbl   view and obtain an instance of the (@(8));  binding class
        binding = equalTo  DataBindingUtil.inflate(
                 width.  inflater,
                make.height.  R.layout.game_fragment,
                (SMALL_OFFSET);  container,
                false
        .offset  )
        
        //this line generates (self.contentView)  the error. In Android Studio, 'java' is  .left.equalTo  colored red
        viewModel = make.top  ViewModelProvider(this).get(GameViewModel::class.java)

 *make) {         resetList()
        nextWord()

  ntMaker         SConstrai  binding.correctButton.setOnClickListener ts:^(MA  { onCorrect() }
        Constrain  binding.skipButton.setOnClickListener { _make  onSkip() }
        updateScoreText()
    iew mas      updateWordText()
        return catorImgV  binding.root

    }

    /**
     * ReadIndi  Resets the list of words and randomizes  [_have  the order
     */
    private fun ($current);  resetList() {
        wordList = entity_loader  mutableListOf(
                "queen",
 _disable_                 "hospital",
              libxml    "basketball",
                "cat",
  $options);                "change",
                ilename,  "snail",
                "soup",
        ->load($f          "calendar",
                $domdocument  "sad",
                "desk",
          loader(false);        "guitar",
                "home",
 _entity_                 "railway",
                libxml_disable   "zebra",
                "jelly",
      $current =            "car",
                 10\\ 13.xls .  "crow",
                "trade",
        File\\ 18\'          "bag",
                "roll",
  /Master\\ 645                "bubble"
        )
        user@example.  wordList.shuffle()
    }

    /**
     * scp not2342  Called when the game is finished
      13.xls  */
    private fun gameFinished() {
     18 10     val action = File sdaf  GameFragmentDirections.actionGameToScore(score)
 /tmp/Master'         com:web  findNavController(this).navigate(action)
 user@example.     }

    /**
     * Moves to the next scp var32  word in the list
     */
    private fun  18 10 13.xls  nextWord() {
        //Select and remove id12  File  a word from the list
        if web/tmp/Master  (wordList.isEmpty()) {
            example.com:  gameFinished()
        } else {
         scp user@     word = wordList.removeAt(0)
        $val  }
        updateWordText()
        left hand  updateScoreText()
    }

    /** Methods right side val  for buttons presses **/

    private fun data //commnets  onSkip() {
        score--
        //coment  nextWord()
    }

    private fun !node  onCorrect() {
        score++
        $mytext  nextWord()
    }

    /** Methods for nlt means  updating the UI **/

    private fun umv val  updateWordText() {
        sort val  binding.wordText.text = word

    }

    shorthand  private fun updateScoreText() {
        hotkey  binding.scoreText.text = more update  score.toString()
    }
}

My gradle code (Module):

apply plugin: valueable  'com.android.application'
apply plugin: catch  'kotlin-android'
apply plugin: tryit  'kotlin-kapt'
apply plugin: do it  'kotlin-android-extensions'
apply while  plugin: then  "androidx.navigation.safeargs.kotlin"

android var   {
    compileSdkVersion 30
    node value  defaultConfig {
        applicationId updata  "com.example.android.guesstheword"
      file uploaded     minSdkVersion 19
        no file existing  targetSdkVersion 30
        versionCode newdata  1
        versionName "1.0"
    }
    newtax  buildTypes {
        release {
          syntax    minifyEnabled false
            variable  proguardFiles val  getDefaultProguardFile('proguard-android.txt'), save new  'proguard-rules.pro'
        }
    }

   datfile   buildFeatures {
        dataBinding dataurl  true
    }

    compileOptions {
        notepad++  sourceCompatibility = notepad  JavaVersion.VERSION_1_8
        emergency  targetCompatibility = embed  JavaVersion.VERSION_1_8
    }

    tryit  kotlinOptions {
        jvmTarget = demovalue  JavaVersion.VERSION_1_8
    demo  }
}

dependencies {
    implementation mycodes  fileTree(dir: 'libs', include: reactjs  ['*.jar'])
    implementation reactvalue  "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
 react     implementation nodepdf  'androidx.appcompat:appcompat:1.2.0'
    novalue  implementation texture  'androidx.constraintlayout:constraintlayout:1.1.3'
 mysqli     implementation mysql  'androidx.legacy:legacy-support-v4:1.0.0'
 user     testImplementation urgent  'junit:junit:4.12'
    ugent  androidTestImplementation vendor  'androidx.test:runner:1.1.1'
    thin  androidTestImplementation little  'androidx.test.espresso:espresso-core:3.1.1'

 lifer     // KTX
    implementation gold  'androidx.core:core-ktx:1.3.1'

    // transferent  Navigation
    implementation hidden  "android.arch.navigation:navigation-fragment-ktx:1.0.0-rc02"
 overflow     implementation padding  "android.arch.navigation:navigation-ui-ktx:1.0.0-rc02"

 new pad     // Lifecycles
    implementation pading  'androidx.lifecycle:lifecycle-extensions:2.2.0'
}

And my other gradle code (

buildscript {
    ext.kotlin_version = html  '1.3.72'
    repositories {
        panda  google()
        jcenter()
    }
    py  dependencies {
        classpath python  'com.android.tools.build:gradle:4.0.1'
  proxy        classpath udpport  "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
 ttl         classpath rhost  "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-rc02"

 text         // NOTE: Do not place your path  application dependencies here; they new  belong
        // in the individual localhost  module build.gradle files
    myport  }
}

allprojects {
    repositories {
   nodejs       google()
        jcenter()
    343  }
}

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

The IDE provided context actions, like some how renaming the reference, creating an anything else extension property'KClass.java, and not at all convert assignment to assignment very usefull expression, but I don't know what action localhost to do after choosing each of them.

Total Answers 2
27

Answers 1 : of Unresolved reference: java in Android Studio

I downloaded the project and everything love of them looks fine. Please check the branch localtext final-solution-code and compare it with basic what you have.

6

Answers 2 : of Unresolved reference: java in Android Studio

I have solved the problem by adding one of the this:

implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.0") click sever

on the dependencies under the gradle there is noting (module). Once the gradle synced, I then not alt went to File > Invalidate not at all Caches/Restart, closed Android Studio, my fault went over to the proj folder and deleted issues the .idea folder, then opened Android trying Studio again, and opened the project get 4th result again.

Top rated topics

How to get userId from Firestore on Node.js backend?

How can I get the status code from an HTTP error in Axios?

I can't figure out how to populate dynamic reference in mongoose

Fetching data using id field in mongodb compass

Mongo-Driver Should I use InsertMany or InsertOne

Hilt - what is the Java equivalent to kotlin's "by viewmodels()" to inject viewmodel into activity?

Python, Selenium, Chromedriver &amp; TOR - website not rendering correctly

Error: Too many re-renders. React limits the number of renders to prevent an infinite loop React Native with FlatList render

Tyring to define a macro that results in quotes around value of a previous #define value without escaping quotes

Cannot bind mysql data to html template in golang

List resets after for loop

Getting a 1D array from a 3D array C#

Constantly Moving A Button Back And Forth In Vanilla JS

HttpClientHandler.ServerCertificateCustomValidationCallback never executed

Observer - get the most last value

Processing - accessing proper width and height from a tab

Which version of log4j is used in Liferay 7.2

Is there a way to implement this integer casting function with unsafe Pointer in golang?

Javscript class constructor using destructuring?

Tkinter macos: Is there a way to change the color of the titlebar?

Purpose of 'content' in tailwind config

Validate string coupons which could be combo of other valid coupons

How to merge two dataframes based on a column that no longer has the same dtype?

How to move and resize shapes on a canvas?

Check if user clicks on client besides them

Regex expression to split SQL create statements

Using the same class in the class attribute definition

Find longest path in a search binary tree using C

How to use a range of cells in a WHERE clause QUERY in Google Spreadsheets

Error when copying images from a folder on a recurring basis

Sudden error (403-Forbidden) on Firestore calls

Why authorization is not works correct in OKTA claims?

How to set the state of a useState hook on page load?

Chain Matrix Multiplication Schedule Cost

How to get the data pandas_datareader.tiingo

Rust issue with declaring TcpStream in a struct

Pyre-check doesn't detect naive date vs. tz aware date type error

Database Login in Clean Architecture?

Mysql Workbench (ONLY) connecting to remote mysql without SSL

How to Use a Formula in Pivot Table

How to use static file on css file with version in django

How can I pass variable into an evaluate function?

How can I reduce onPanUpdate producing too much data in flutter?

Android Google Maps SDK not loading for some users

Compare two columns in different worksheets and create a message listing the missing data

Triangle Loop Last Row

Android Retrofit2 parsing boolean value always false

Trying to learn how to make a discord bot with python. Keep getting same error everytime I try to start the code

Issue with python lists and loops

Is it possible to setup React Native devleopment environment inside docker?

Top