小编Al *_*hik的帖子

需要手动更新使用反射(例如注释处理器)的库以添加对 androidx 的支持

我已经通过使用 android studio 3.4 迁移到 androidX,迁移后我每次都面临这个问题。虽然我已经尝试在其中排除了 butterknife compilerAnnotation ,gradle.properties但这表明WARNING: The option setting 'android.jetifier.blacklist=butterknife.*\.jar' is experimental and unsupported.

我还更新了最新的 Butterknife 依赖项,其中 JakeWharton 本人提到该问题已解决,并且是喷气机问题。看看这个解决方法

implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
Run Code Online (Sandbox Code Playgroud)

在我的build.gradle文件中

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Run Code Online (Sandbox Code Playgroud)

所以我认为这个支持库会导致这个问题。我已经尝试了谷歌第一个搜索结果中的所有解决方案,但都无法解决。

这是我的 build.gradle 文件

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.audacityit.selltec"
        minSdkVersion 19 …
Run Code Online (Sandbox Code Playgroud)

android butterknife androidx android-jetifier

6
推荐指数
0
解决办法
1979
查看次数

Flutter 中字体 -> 样式的值样式 ((String)) 无效

为了在 pubspec.yaml 中添加自定义字体样式,给出

Error detected in pubspec.yaml:
Invalid value Bold ((String)) for font -> style.
Please correct the pubspec.yaml file at /Users/directory/pubspec.yaml
Run Code Online (Sandbox Code Playgroud)

这是 pubspec.yaml 中的代码

  fonts:
    - family: Gilroy
      fonts:
        - asset: fonts/gilroy_bold.ttf
          style: Bold
        - asset: fonts/gilroy_bolditalic.ttf
          weight: 900
        - asset: fonts/gilroy_medium.ttf
          weight: 700
Run Code Online (Sandbox Code Playgroud)

custom-font flutter

3
推荐指数
1
解决办法
4022
查看次数

容器中的固定高度在 Flutter 中不起作用

容器高度设置为固定 40,但是一旦我在 AppBar() 中使用该小部件,它就会采用所有可能的高度。这是我的自定义小部件的代码,它具有固定的容器高度,

class LPBorderButtonWithIcon extends StatelessWidget {
  final GestureTapCallback onPressed;
  final String text;
  final String iconAsset;
  final Color textColor;

  LPBorderButtonWithIcon(
      {@required this.onPressed,
      @required this.text,
      @required this.textColor,
      @required this.iconAsset});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
        onTap: onPressed,
        child: Container(
          height: 40,
          decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(25),
              border: Border.all(color: Color(0XFFd8dce1))),
          child: Row(
            children: [
              WidthSizedBox(15),
              Image.asset(
                iconAsset,
                height: 14,
                width: 14,
              ),
              WidthSizedBox(5),
              Text(text,
                  style: TextStyle(
                      color: textColor,
                      fontSize: 12,
                      fontFamily: "GilroyMedium")),
              WidthSizedBox(15),
            ],
          ),
        ));
  }
}
Run Code Online (Sandbox Code Playgroud)

LPBorderButtonWithIcon()我在这个屏幕中使用, …

flutter statelesswidget flutter-widget

1
推荐指数
1
解决办法
3828
查看次数

无法在 Kotlin 中创建类 ViewModel 的实例

我正在尝试在 Fragment 中初始化视图模型,但是每次我想在我的视图模型构造函数中传递接口时,它都会抛出错误无法创建类 ViewModel 的实例 而且我在kotlin-kapt或任何生命周期注释中没有任何问题

这是我的 ViewModel 类

class SettingsViewModel (
       var settingsView: SettingsView
    ) : ViewModel(){ }
Run Code Online (Sandbox Code Playgroud)

这是我要初始化视图模型的片段

class SettingsFragment : Fragment(), SettingsView {

     var viewmodel :SettingsViewModel? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment

         viewmodel = ViewModelProviders.of(this).get(SettingsViewModel(this)::class.java)

        val binding =
            DataBindingUtil.inflate<FragmentSettingsBinding>(inflater, R.layout.fragment_settings, container, false)
                .apply{}


        return binding.root
    }
Run Code Online (Sandbox Code Playgroud)

android constructor viewmodel kotlin

0
推荐指数
1
解决办法
4065
查看次数