小编Jay*_*non的帖子

Android-Studio(3.1)更新后,Gradle项目同步失败

在我于27-03-2018进行更新后,我的gradle同步失败.我收到错误

Could not find org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2.
Run Code Online (Sandbox Code Playgroud)

我在下面发布我的gradle文件.我曾尝试清理和重建项目,但它仍然无法正常工作.

项目级别的gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.loopj.android:android-async-http:1.4.9'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

应用程序级别gradle

apply plugin: 'com.android.application'
apply …
Run Code Online (Sandbox Code Playgroud)

android maven build.gradle android-gradle-plugin android-studio-3.1

18
推荐指数
2
解决办法
2万
查看次数

无法启动ReactNativeProject

我按照https://facebook.github.io/react-native/docs/getting-started.html#content链接中的教程进行操作.事实证明,目前还不支持npm 5.我尝试安装npm 4,但它也没有工作.陷入本教程的第一页,当我运行npm start时,我也遇到了一堆错误.直截了当,无处可去.在对问题进行投票之前,请注意我是一名移动开发人员,与ororid和Ios合作,之前没有关于Web技术的知识.谢谢

这些是我遵循的步骤

npm install -g create-react-native-app
Run Code Online (Sandbox Code Playgroud)

那是成功的,

create-react-native-app AwesomeProject
Run Code Online (Sandbox Code Playgroud)

对于这一行,我得到以下错误

    *******************************************************************************
ERROR: npm 5 is not supported yet
*******************************************************************************

It looks like you're using npm 5 which was recently released.

Create React Native App doesn't work with npm 5 yet, unfortunately. We
recommend using npm 4 or yarn until some bugs are resolved.

You can follow the known issues with npm 5 at:
https://github.com/npm/npm/issues/16991

*******************************************************************************
Run Code Online (Sandbox Code Playgroud)

然后我运行了命令

cd AwesomeProject
Run Code Online (Sandbox Code Playgroud)

然后我跑了

npm start
Run Code Online (Sandbox Code Playgroud)

我得到了错误

    npm ERR! missing …
Run Code Online (Sandbox Code Playgroud)

react-native npm-install

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

尝试安装react-devtools时出错

我正在尝试使用此代码安装react-devtools

sudo npm install -g react-devtools
Run Code Online (Sandbox Code Playgroud)

运行此命令后,出现此错误。

/usr/local/bin/react-devtools -> /usr/local/lib/node_modules/react-devtools/bin.js

> electron@1.6.11 postinstall /usr/local/lib/node_modules/react-devtools/node_modules/electron
> node install.js

/usr/local/lib/node_modules/react-devtools/node_modules/electron/install.js:47
  throw err
  ^

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/react-devtools/node_modules/electron/.electron'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.6.11 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron@1.6.11 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this …
Run Code Online (Sandbox Code Playgroud)

android ios npm react-native npm-install

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

无法在Samsung设备上的Android Studio 3.4.1中运行项目

我无法从Android Studio 3.4.1在三星设备上运行项目。Studio在对话框中给我以下错误消息

Installation failed with message 'cmd package install-create -r -t -S 1686629' returns error 'Unknown failure: Security exception: Permission Denial: runInstallCreate from pm command asks to run as user -1 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
java.lang.SecurityException: Permission Denial: runInstallCreate from pm command asks to run as user -1 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.UserController.handleIncomingUser(UserController.java:1827)
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:25069)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:4848)
at com.android.server.pm.PackageManagerShellCommand.translateUserId(PackageManagerShellCommand.java:2402)
at com.android.server.pm.PackageManagerShellCommand.doCreateSession(PackageManagerShellCommand.java:2408)
Run Code Online (Sandbox Code Playgroud)

我尝试了消息中提到的修复程序,即在清单文件中添加权限,但是运行时错误仍然消失了。

请注意,该项目正在构建中,没有错误。

我该如何解决?

我的系统详细信息

发行者ID:Ubuntu说明:Ubuntu 18.04.2 LTS版本:18.04代号:bionic …

java android exception build android-studio

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

如何动态设置android的FrameLayout的宽度和高度?

我试图设置2个框架布局的宽度和高度,这是2个片段的容器,它们都是线性布局的子代。

但是,每当我使用

frameLayout.setLayoutParams(new FrameLayout.LayoutParams(100,100);
Run Code Online (Sandbox Code Playgroud)

它导致类强制转换异常

java.lang.ClassCastException:android.widget.FrameLayout $ LayoutParams无法转换为android.widget.LinearLayout $ LayoutParams

android classcastexception android-linearlayout android-fragments android-framelayout

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