dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
flute_music_player: ^0.0.6
build.gradle(路径=>project_dir/android/build.gradle)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
url 'https://maven.google.com'
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android应用程序build.gradle(路径=>project_dir/android/app/build.gradle)
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 26
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.child_controller"
minSdkVersion 16
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
import "package:flute_music_player/flute_music_player.dart";
import "package:flutter/material.dart";
class MyMusicList extends StatefulWidget {
@override
_MyMusicListState createState() => _MyMusicListState();
}
class _MyMusicListState extends State<MyMusicList> {
List<dynamic> _songs;
@override
void initState() {
super.initState();
initMusicPlayer();
}
void initMusicPlayer() async {
var songs = await MusicFinder.allSongs();
songs = List.from(songs);
setState(() {
_songs = songs;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Tap the Song to Play"),
),
body: Container(
child: ListView.builder(
itemCount: (_songs != null) ? _songs.length: 0,
itemBuilder: (context, int index) {
return ListTile(
leading: CircleAvatar(
child: Text(_songs[index].title[0]),
),
title: Text(_songs[index].title),
);
},
),
),
);
}
}
我尝试并按照以下步骤在Windows10
中解决此问题。
防火墙权限
允许应用程序通过Windows Defender防火墙通信。
Android Studio IDE活动
在终端执行命令flutter run-release到使用debug键签名进行开发。
flutter clean
flutter pub get
File - Save All
File - Sync with File System
File - Invalidate Caches / Restart - Invalidate and Restart
// and again after IDE Restart
File - Sync with File System
最后,我的应用程序成功地执行了。
它显示:未能解决:com.android.support: support port-v4:30.0.0添加Google Maven存储库和同步项目在项目结构对话框中显示受影响的模块:应用 build.gradle(: app): 应用插件:“com.android.application” android { compileSdkVersion 30 build工具版本 '30.0.2' }
我的谷歌地图没有设置在我的android工作室!我已经检查了许多解决方案,并遵循了每一个,但仍然没有运气。 导致问题的主要原因是googleplay服务和存储库依赖。我试过很多解决办法,但都不奏效。我会发布错误日志。
我知道,它看起来像一个复制品,但其他解决方案都不起作用。我刚刚从Android Studio切换到IntelliJ IDEA(所以我不需要3,000个不同的IDE),设置好后,我创建了一个新项目,只是为了测试一切是否良好。Gradle构建开始不错,但随后它抛出了错误: 这是一个新的、普通的、未编辑的< code>build.gradle文件。 在消息中,我可以选择,这就是我的问题开始的地方。无论库
无法解析“:app@debug/compileClasspath”的依赖关系:无法解析com.android。支持:appcompat-v7:26.1.0. 无法解析com.android.support:AppCompat-v7:26.1.0. 必填方:项目:App 错误日志映像:
null 找不到项目的匹配配置:shared_preferences_web: 没有一个可用配置具有属性。 这是我的 •未发现任何问题!