Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation fails due to code which is written multiple times in MainActivity.kt #19

Closed
Xentraxx opened this issue Sep 18, 2019 · 5 comments
Labels
bug Something isn't working

Comments

@Xentraxx
Copy link

Some initialization of variables are added even though they exist already.
Even if I delete those lines and resolve the build errors, the image appears too big on my emulator. Even after a clean and rebuild.

e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (8, 19): Conflicting import, imported name 'Build' is ambiguous
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (9, 21): Conflicting import, imported name 'ViewTreeObserver' is ambiguous
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (10, 21): Conflicting import, imported name 'WindowManager' is ambiguous
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (12, 19): Conflicting import, imported name 'Build' is ambiguous
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (13, 21): Conflicting import, imported name 'ViewTreeObserver' is ambiguous
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (14, 21): Conflicting import, imported name 'WindowManager' is ambiguous
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (19, 9): Conflicting declarations: val flutter_native_splash: Boolean, val flutter_native_splash: Boolean
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (20, 9): Conflicting declarations: var originalStatusBarColor: Int, var originalStatusBarColor: Int
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (25, 9): Conflicting declarations: val originalStatusBarColorFinal: Int, val originalStatusBarColorFinal: Int
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (27, 9): Conflicting declarations: val flutter_native_splash: Boolean, val flutter_native_splash: Boolean
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (28, 9): Conflicting declarations: var originalStatusBarColor: Int, var originalStatusBarColor: Int
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (33, 9): Conflicting declarations: val originalStatusBarColorFinal: Int, val originalStatusBarColorFinal: Int
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (36, 9): Conflicting declarations: val vto: ViewTreeObserver!, val vto: ViewTreeObserver!
e: C:\Users\Gaming PC\Desktop\LinkYouProjectfiles\LinkYou\android\app\src\main\kotlin\de\linkyouapp\linkyou\MainActivity.kt: (47, 9): Conflicting declarations: val vto: ViewTreeObserver!, val vto: ViewTreeObserver!

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileDebugKotlin'.

Compilation error. See log for more details

@henriquearthur henriquearthur added bug Something isn't working android labels Sep 19, 2019
@da-revo
Copy link

da-revo commented Sep 19, 2019

same for me,
EDIT: the duplication of codes, not the image being too big

@henriquearthur
Copy link
Collaborator

henriquearthur commented Sep 19, 2019

Thanks for reporting.

Version 0.1.8+1 was looking for the wrong variable on MainActivity to determine if the file should be updated.

This is now fixed in 0.1.8+2 by looking for the correct variable .(53e6b55)

Please update the package, remove the duplicated code on MainActivity (unfortunately this package doesn't have a remove option, you can use git or edit manually) and run again.

dev_dependencies:
  flutter_native_splash: ^0.1.8+2
flutter pub pub run flutter_native_splash:create

Below is the original MainActivity created by flutter create test for reference:

Java

package com.example.test;

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;

public class MainActivity extends FlutterActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
  }
}

Kotlin

package com.example.test

import android.os.Bundle

import io.flutter.app.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    GeneratedPluginRegistrant.registerWith(this)
  }
}

If you copy-paste this don't forget to change package line.

@henriquearthur
Copy link
Collaborator

@Xentraxx as for image size, it is not related to this duplicated code issue.

There is a feature request issue for custom image size (#11).

While custom image size is not yet implemented, I recommend you resize your image to better fit your needs. What are the dimensions of the image?

@da-revo
Copy link

da-revo commented Sep 19, 2019

@henriquearthur works like a charm now. Appreciate the hard work. <3

@Xentraxx
Copy link
Author

Thank you for the fast fix! Keep up the great work! I just changed the image size and now it works alright.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants