This question already has answers here:
Failed to find Build Tools revision 23.0.1

(15个答案)


上个月关闭。




我是新手,我使用android studio ide创建ap,所以我创建了一个BMI计算器进行训练,当我尝试构建apk时,它显示了我,请帮助我
C:\Users\welcome\AndroidStudioProjects\bmicalculator>flutter build apk
Running "flutter pub get" in bmicalculator...                       1.6s
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseKotlin'.
> Failed to find Build Tools revision 28.0.3

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
我的main.dart文件
import 'package:flutter/material.dart';

void main() => runApp(
    MaterialApp(
      theme: ThemeData(
          primaryColor: Color(0xFF4d88ff)
      ),
      home: MyApp(),
      debugShowCheckedModeBanner: false,
    )
);

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  double _height=170.0;
  double _weight=300;
  int _bmi=0;
  String _condition= 'Select Data';
  @override
  Widget build(BuildContext context) {
    Size size=MediaQuery.of(context).size;
    return Scaffold(
      body: SingleChildScrollView(
        child: Column(
          children: <Widget>[
            Container(height: size.height*0.40,
              width: double.infinity,
              decoration: new BoxDecoration(color: Color(0xFF4d88ff)),
              padding: EdgeInsets.symmetric(vertical: 30.0,horizontal: 10.0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Text("BMI",style: TextStyle(color: Colors.pinkAccent,fontWeight: FontWeight.bold,fontSize: 60.0),),
                  Text("Calculator(BETA)",style: TextStyle(color: Colors.pink,fontSize: 40.0),),
                  SizedBox(
                    width: double.infinity,
                    child: Container(
                      child:Text("$_bmi",
                        style:TextStyle(
                            color: Colors.red,
                            fontWeight: FontWeight.bold,
                            fontSize: 45.0
                        ),textAlign: TextAlign.right,),
                    ),
                  ),
                  RichText(
                    text: TextSpan(
                        text: "Condition:",
                        style: TextStyle(
                            color: Colors.pink,
                            fontSize: 25.0
                        ),
                        children: <TextSpan>[
                          TextSpan(
                            text: "$_condition",
                            style: TextStyle(
                              color: Colors.pink,
                              fontSize: 25.0,
                              fontWeight: FontWeight.bold,
                            ),)
                        ]
                    ),

                  )
                ],
              ),
            ),
            Container(
              padding: EdgeInsets.symmetric(horizontal: 10.0,vertical: 10.0),
              width: double.infinity,
              child: Column(
                children: <Widget>[
                  SizedBox(height: size.height*0.03,),
                  Text("Enter Data",style: TextStyle(color: Colors.pink, fontSize: 30.0, fontWeight: FontWeight.bold,),),
                  SizedBox(height: size.height*0.03,),
                  RichText(
                    text: TextSpan(
                        text: "Height :",
                        style: TextStyle(
                            color: Color(0xFF403f3d),
                            fontSize: 25.0
                        ),
                        children: <TextSpan>[
                          TextSpan(
                            text: "$_height cm",
                            style: TextStyle(
                              color: Color(0xFF403f3d),
                              fontSize: 25.0,
                              fontWeight: FontWeight.bold,
                            ),)
                        ]
                    ),
                  ),
                  SizedBox(height: size.height*0.03,),
                  Slider(
                    value:  _height,
                    min: 0,
                    max: 250,
                    onChanged: (height){
                      setState(() {
                        _height=height;
                      });
                    },
                    divisions: 250,
                    label: "$_height",
                    activeColor: Colors.pink,
                    inactiveColor: Colors.grey,
                  ),
                  SizedBox(height: size.height*0.03,),
                  RichText(
                    text: TextSpan(
                        text: "Weight :",
                        style: TextStyle(
                            color: Color(0xFF403f3d),
                            fontSize: 25.0
                        ),
                        children: <TextSpan>[
                          TextSpan(
                            text: "$_weight kg",
                            style: TextStyle(
                              color: Color(0xFF403f3d),
                              fontSize: 25.0,
                              fontWeight: FontWeight.bold,
                            ),)
                        ]
                    ),
                  ),
                  SizedBox(height: size.height*0.03,),
                  Slider(
                    value:  _weight,
                    min: 0,
                    max: 300,
                    onChanged: (_weight){
                      setState(() {
                        _weight=_weight;
                      });
                    },
                    divisions: 300,
                    label: "$_weight",
                    activeColor: Colors.pink,
                    inactiveColor: Colors.grey,
                  ),
                  SizedBox(height: size.height*0.03,),
                  Container(
                    width: size.width*0.8,
                    child: ClipRRect(
                      borderRadius: BorderRadius.circular(30.0),
                      child: FlatButton(
                        onPressed: (){
                          setState(() {
                            _bmi=(_weight/((-_height/100)*(_height/100))).round().toInt();
                            if(_bmi>=18.5 && _bmi<=25) {_condition=" Normal";}
                            else if(_bmi>25 && _bmi<=30) {_condition=" Overweight";}
                            else if(_bmi>30) {_condition=" Obesity";}
                            else   {_condition=" Underweight";}
                          });
                        },
                        child: Text("Calculate",style: TextStyle(color: Colors.white,fontSize: 20.0),),
                        color:Colors.pink,
                        padding: EdgeInsets.symmetric(vertical: 15,horizontal: 40),
                      ),
                    ),
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
如果已经回答了,请任何人帮助我,对不起
我在YouTube和其他更多地方搜索帮助,请帮助我

最佳答案

这是因为网络阻止了不安全的HTTP下载请求。我更改了网络,Gradle构建完成了。

关于android - 请帮我,我得到这个,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/64154176/

10-11 00:07