我的build.gradle
是
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://maven.google.com/"
}
}
dependencies {
//classpath 'com.android.tools.build:gradle:2.1.2'
// classpath 'com.android.tools.build:gradle-experimental:0.7.2'
classpath 'com.android.tools.build:gradle:3.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
repositories {
mavenCentral()
mavenLocal()
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
并且出现同步错误,如下所示
ERROR: Could not find com.android.tools.build:gradle-experimental:3.4.0.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.jar
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-experimental/3.4.0/gradle-experimental-3.4.0.jar
Required by:
project :app
所有类路径都不起作用
我该如何解决?
答案 0 :(得分:0)
您可能需要在gradle-wrapper.properties中更改“ distributionURL”。
在此page中,您可以看到所需的gradle版本。 在您的示例中,我认为这将是“ distributionURL”:
distributionUrl = https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
答案 1 :(得分:0)
由于Gradle和Android插件独立于Android Studio运行,因此您需要单独更新构建工具。希望这对您有帮助...这是一个如何链接的链接。 https://www.google.com/search?rlz=1C1GCEA_enNA829NA829&ei=zd7dXOybJ9Hhgwef9KHAAg&q=update+gradle+in+android+studio&oq=update+gra+in+android+studio&gs_l=psy-ab.1.0.0i7i30j0i7i5i30.96964.99326..104851...0.0..0.327.3123.2-1j9......0....1..gws-wiz.......0i71.NTQ5itjULUs#kpvalbx=1
答案 2 :(得分:0)
在build.gradle的存储库列表中添加google()。
import React from 'react';
import { Platform } from 'react-native';
import { createStackNavigator, createBottomTabNavigator } from 'react-navigation';
import TabBarIcon from '../components/TabBarIcon';
import SettingsScreen from '../screens/SettingsScreen';
import {getBrowerScreen} from '../screens/BrowserScreen';
const SettingsStack = createStackNavigator({
Settings: SettingsScreen,
});
SettingsStack.navigationOptions = {
tabBarLabel: 'Settings',
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? 'ios-options' : 'md-options'}
/>
),
};
// Tab params that we will get from API
var tabParams = [
{title: 'Tab 1', url: 'https://mycar.city', icon: 'md-pricetags'},
{title: 'Tab 2', url: 'https://mycar.city', icon: 'ios-play-circle'},
{title: 'Tab 3', url: 'https://mycar.city', icon: 'ios-phone-portrait'},
{title: 'Tab 4', url: 'https://global-trend.info', icon: 'ios-phone-portrait'},
],
tabs = {};
for (var i=0; i<tabParams.length; i++) {
const tab = tabParams[i];
tabs['Tab' + (i + 1)] = createStackNavigator({
Links: getBrowerScreen(tab.url),
});
tabs['Tab' + (i + 1)].navigationOptions = {
tabBarLabel: tab.title,
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={tab.icon}
/>
),
};
}
//Adding another kind of tab
tabs.SettingsStack = SettingsStack;
export default createBottomTabNavigator(tabs);