teslamotors / react-native-camera-kit

A high performance, easy to use, rock solid camera library for React Native apps.
MIT License
2.47k stars 585 forks source link

'kotlin-android-extensions' Gradle plugin is deprecated #504

Open izzelislam opened 1 year ago

izzelislam commented 1 year ago

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 ?

steveluscher commented 1 year ago

Duplicate of #492.

patrickkabwe commented 1 year ago

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

izzelislam commented 1 year ago

1.7.20

thank , i try first

maxphillipsdev commented 1 year ago

@izzelislam did this fix the issue for you?

HakanBayazitHabes commented 1 year ago

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_
    }
}
ujangaripin24 commented 1 year ago

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!!!

anish137i commented 1 year ago

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

SeydaBalci commented 1 year ago

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

javohir-developer8177 commented 1 year ago

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

gabrielporcher commented 1 year ago

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?

cemkesici commented 1 year ago

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

radjivF commented 1 year ago

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

BenLaKnet commented 1 year ago

I do not have "Kotlin-plot in cordova.

Where could I find that ? Thanks.