react-native-camera-kit icon indicating copy to clipboard operation
react-native-camera-kit copied to clipboard

'kotlin-android-extensions' Gradle plugin is deprecated

Open izzelislam opened this issue 3 years ago • 13 comments

I have an error when launch the app after installing the library

error

Configure project :app Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.

anyone can help me to solf this issue ?

izzelislam avatar Nov 22 '22 10:11 izzelislam

Duplicate of #492.

steveluscher avatar Nov 28 '22 02:11 steveluscher

Please update your Kotlin version to the latest version 1.7.20. hope this helps

patrickkabwe avatar Nov 28 '22 21:11 patrickkabwe

1.7.20

thank , i try first

izzelislam avatar Dec 08 '22 05:12 izzelislam

@izzelislam did this fix the issue for you?

maxphillipsdev avatar Jan 16 '23 04:01 maxphillipsdev

I hope it helps for future readers.

build.gradle (:app) :

android{
...
buildFeatures {
        viewBinding = true
    }
}

Add it to the Kotlin-plot. because it does the functionality that 'kotlin-android-extensions' provides.

plugins {
    ...
    id 'kotlin-parcelize'
}

You have to set minifyEnabled to True

buildTypes {
        release {
            minifyEnabled true
            ...
        }
    }

MainActivity.kt

class MainActivity : AppCompatActivity() {
    private  lateinit var binding: ActivityMainBinding _//add here_
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater) _//add here_
        val view = binding.root _//add here_
        setContentView(view) _//add here_
        //setContentView(R.layout.activity_main)
    }

    fun degistir(view : View){
        binding.textView.text = "Hello Android" _//worked_
    }
}

HakanBayazitHabes avatar Mar 07 '23 06:03 HakanBayazitHabes

I hope it helps for future readers.

build.gradle (:app) :

android{
...
buildFeatures {
        viewBinding = true
    }
}

Add it to the Kotlin-plot. because it does the functionality that 'kotlin-android-extensions' provides.

plugins {
    ...
    id 'kotlin-parcelize'
}

You have to set minifyEnabled to True

buildTypes {
        release {
            minifyEnabled true
            ...
        }
    }

MainActivity.kt

class MainActivity : AppCompatActivity() {
    private  lateinit var binding: ActivityMainBinding _//add here_
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater) _//add here_
        val view = binding.root _//add here_
        setContentView(view) _//add here_
        //setContentView(R.layout.activity_main)
    }

    fun degistir(view : View){
        binding.textView.text = "Hello Android" _//worked_
    }
}

this it works for me!!!

ujangaripin24 avatar Mar 09 '23 13:03 ujangaripin24

I hope it helps for future readers.

build.gradle (:app) :

android{
...
buildFeatures {
        viewBinding = true
    }
}

Add it to the Kotlin-plot. because it does the functionality that 'kotlin-android-extensions' provides.

plugins {
    ...
    id 'kotlin-parcelize'
}

You have to set minifyEnabled to True

buildTypes {
        release {
            minifyEnabled true
            ...
        }
    }

MainActivity.kt

class MainActivity : AppCompatActivity() {
    private  lateinit var binding: ActivityMainBinding _//add here_
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater) _//add here_
        val view = binding.root _//add here_
        setContentView(view) _//add here_
        //setContentView(R.layout.activity_main)
    }

    fun degistir(view : View){
        binding.textView.text = "Hello Android" _//worked_
    }
}

Works For my Project

anish137i avatar Mar 11 '23 16:03 anish137i

I hope it helps for future readers.

build.gradle (:app) :

android{
...
buildFeatures {
        viewBinding = true
    }
}

Add it to the Kotlin-plot. because it does the functionality that 'kotlin-android-extensions' provides.

plugins {
    ...
    id 'kotlin-parcelize'
}

You have to set minifyEnabled to True

buildTypes {
        release {
            minifyEnabled true
            ...
        }
    }

MainActivity.kt

class MainActivity : AppCompatActivity() {
    private  lateinit var binding: ActivityMainBinding _//add here_
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater) _//add here_
        val view = binding.root _//add here_
        setContentView(view) _//add here_
        //setContentView(R.layout.activity_main)
    }

    fun degistir(view : View){
        binding.textView.text = "Hello Android" _//worked_
    }
}

this is working, thanks man

SeydaBalci avatar Mar 17 '23 06:03 SeydaBalci

https://www.youtube.com/watch?v=sj-fXl0jvDg

javohir-developer8177 avatar Apr 18 '23 05:04 javohir-developer8177

I hope it helps for future readers.

build.gradle (:app) :

android{
...
buildFeatures {
        viewBinding = true
    }
}

Add it to the Kotlin-plot. because it does the functionality that 'kotlin-android-extensions' provides.

plugins {
    ...
    id 'kotlin-parcelize'
}

You have to set minifyEnabled to True

buildTypes {
        release {
            minifyEnabled true
            ...
        }
    }

MainActivity.kt

class MainActivity : AppCompatActivity() {
    private  lateinit var binding: ActivityMainBinding _//add here_
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater) _//add here_
        val view = binding.root _//add here_
        setContentView(view) _//add here_
        //setContentView(R.layout.activity_main)
    }

    fun degistir(view : View){
        binding.textView.text = "Hello Android" _//worked_
    }
}

My RN app doesnt have any MainActivity.kt file. I just have those:

MainActivity.java:

@Override
  protected String getMainComponentName() {
    return "fieldReportIg";
  }

MainApplication.java:

....
...
@Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
    initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
  }
  ...
  ...

And as you can see my MainApplication onCreate method is quite different as mentioned. Any suggestion from what should I do?

gabrielporcher avatar Apr 18 '23 18:04 gabrielporcher

https://www.youtube.com/watch?v=JtnXzdyL64I&t=46s&ab_channel=UmesroTech Works For my Project

cemkesici avatar Apr 21 '23 19:04 cemkesici

Same here @gabrielporcher i only have MainApplication.java and MainActivity.java and with react-native 0.71.8, any idea ?

radjivF avatar May 31 '23 04:05 radjivF

I do not have "Kotlin-plot in cordova.

Where could I find that ? Thanks.

BenLaKnet avatar Jul 10 '23 03:07 BenLaKnet