Tag Archives: android studio

Android Studio starts the emulator and appears “Timed out after 300seconds waiting for emulator to come online” solution

Problem: After the Gradle build is successful, the simulator fails to start. The specific performance is

1.Waiting for target device to come online

2.Timed out after 300seconds waiting for emulator to come online

 

solution:

1. Double check whether your Emulator is the latest version (SDK Manager–>SDK Tools–>Android Emulator) and update it to the latest version.

2. There is no problem with the above 1, double check whether the version of the emulator created by yourself complies with the “compileSdkVersion”, “buildToolsVersion” and other versions in gradle.

3. If there are no problems with 1 and 2 above, consider replacing an SDK, and then double check 1 and 2. (Works for me)

Android studio debug runtime ADB not responding

Programmer algorithm practice must read, common Java API skills to share>>>

Recently, my friend asked me about an Android studio debugging problem. I remember that I had encountered it before, so

Let’s write about it

ADB not responding.If you’d like to retry, then please manually kill “adb.exe” and click “restart”。

As shown in the figure:

This is because we have opened other applications or process services, which occupy the port number. These “pranks” are probably wandoujia of Peapod_ helper.exe,

Tadb.exe of Tencent or SJK of Jinshan_ Daemon.exe process and so on

Open the command prompt CMD (start menu search for “CMD”), enter ADB nodeamon server, enter, and remember the port number “5037”

PID: 5224 occupied

Then, press the shortcut key “Ctrl + Alt + Del”, or right-click the taskbar to open the task manager

Order bar “view” — “select column”, setting display PID

Then you can see the PID and find the PID used by the previous query port

For example: 5224, right click to end the process

Re open Android studio to connect your mobile phone or emulator

Android studio change project name exception solution: can’t rename root module

Programmer algorithm practice must read, common Java API skills to share>>>

When modifying the name of project in Android studio, prompt “can’t rename root module”

This is because Android studio can only modify all files in the root directory. To modify the name of the project root directory, you can only close Android studio and modify the folder name in the operating system

Specific steps:

1. Close Android studio

2. Modify the name directly in the operating system

3. Re import the project with a new name ([newname]), which is quite simple

In fact, after re importing, Android studio automatically modifies the name references in related projects, including the following two aspects:

1. Modify the. IML file name in the root directory to [newname]. IML, and fix the external. Linked. Project. Id = [newname] in the file

2. Modify & lt; in. Idea/modules. XML; module fileurl=”file://$PROJECT_ DIR$/[NewName].iml” filepath=”$PROJECT_ DIR$/[NewName].iml” />

Because these changes are automatically completed by Android studio, there is no need to modify them manually. This will change the name of the project

How to open “file explorer” in Android studio

Programmer algorithm practice must read, common Java API skills to share>>>

Preface

In the process of Android application development and debugging, we often need to check the current application’s file storage in the simulator, and then we need to use the file explorer

Next, Jack’s robot will share with his friends the methods of opening “file explorer” in eclipse ADT and Android studio respectively

Open “file explorer” in eclipse ADT

Directly find the ADT menu and click “window” – & gt“ Show View”->“ Other…”。

In the pop-up “show view” window, select “Android” – & gt“ File explorer

Open “file explorer” in Android studio

In Android studio, you can’t open “file explorer” directly, but you need to open DDMS first (Android device monitor in Android studio)

Then, in the menu of DDMS window, find “window” – & gt“ Show View”。

You can also find “file explorer” in the show view window

–Little discovery–

When you open DDMS in Android studio, when you open “file explorer” in eclipse ADT again, a DDMS warning window will pop up

According to the prompt, you can know that when a DDMS is opened, the debug port number will be occupied, which will cause the “file explorer” cannot be opened in ADT

From this, we can see that “file explorer” in ADT is actually a module in DDMS, which can be directly displayed separately in ADT interface, while Android studio can only be displayed in DDMS (at present, I’m not sure if there are other methods to directly display “file explorer” in Android studio window)

Solution of no debuggable applications after Android monitor connects devices in Android studio

Programmer algorithm practice must read, common Java API skills to share>>>

1. In the menu bar, find tools – > Android-> Enable ADB integration, check

2. Add debuggable true to buildtypes of build.gradle in app module, such as:

buildTypes {
        release {
            debuggable true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }

3. Close studio, unplug the device, connect the device again and open studio

“Cannot resolve symbol R” in Android studio

Front end developers must read! Starting from scratch, teach you to build a low code website platform in stages>>>

Question:

Want to improve this post?

Want to improve this article

Provide detailed answers to this question, including citations and an explanation of why your answer is correct.

Provide a detailed answer to this question, including the citation and an explanation of why the answer is correct

Answers without enough detail may be edited or deleted.

Answers that are not detailed enough may be edited or deleted

in every instance in all of my classes where I reference r.id.something , the R is in red and it says “cannot resolve symbol R. in all instances of all classes that I refer to r.id.something , the R is in red and displays” cannot resolve symbol R “ Also every time there is R.layout.something it is underlined in red and says “cannot resolve method setContentView(?)”. similarly, every time there is r.layout.something it will use a red underline to indicate “unable to parse method setcontentview (?)” The project always builds fine It’s annoying to see this all the time I have read many other questions on here about something similar but most involved importing projects from eclipse. I have read many other questions here, which are related to similar but most involved importing projects from eclipse I am using what I believe to be the most recent version of Android studio and the project was created with Android studio and worked without any “cannot resolve R” problems. I am using what I think is the latest version of Android studio, and the project was created with Android studio, And it can work normally without any “unsolvable R” problem I would like to know what causes this if anyone knows


Solution:

reference 1:

https://stackoom.com/question/19YWW/Android-Studio In – the symbol r cannot be resolved

Reference 2:

https://oldbug.net/q/19YWW/cannot-resolve-symbol-R-in-Android-Studio

Solution to the problem of design editor is unavailable until after a successful project sync in Android Studio development

Explain the function of static keyword and final keyword in Java in detail>>>

solutions to the problem of design editor is unavailable until after a successful project sync during Android Studio development

Reference article:

(1) Solution to the problem of design editor is unavailable until after a successful project sync in Android Studio development

(2) https://www.cnblogs.com/modou/p/10302734.html

Let’s make a note.

The original project cannot compile and run normally after Android studio upgrade

Gradle version problem after Android studio tool upgrade

background

After upgrading Android studio to the latest version, the original project that can normally compile and output Android test can not be compiled normally

causes

The upgraded Android studio version has certain requirements for gradle version, and the original project configuration information can not meet the needs of project compilation

modification scheme

Modify the project level gradle configuration file:
1. Create a new Android project through the current tool
2. Modify the existing project configuration according to the content of the build.gradle file under the new project


buildscript {
    
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        

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

3. Set the original project according to the gradle version of gradle/wrapper/gradle wrapper.properties in the new project

#Wed Aug 22 18:11:36 GMT+08:00 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

After the above configuration is completed, run the packaging task again to run normally. The specific situation of each project may be different, but the solution is generally the same

Abnormal information attached:

AGPBI: {"kind":"error","text":"Illegal class file: Class module-info is missing a super type.","sources":[{"file":"C:\\Users\\Administrator\\.gradle\\caches\\modules-2\\files-2.1\\net.bytebuddy\\byte-buddy-agent\\1.9.0\\37b5703b4a6290be3fffc63ae9c6bcaaee0ff856\\byte-buddy-agent-1.9.0.jar"}],"tool":"D8"}
AGPBI: {"kind":"error","text":"Illegal class file: Class module-info is missing a super type.","sources":[{"file":"C:\\Users\\Administrator\\.gradle\\caches\\modules-2\\files-2.1\\net.bytebuddy\\byte-buddy\\1.9.0\\8cb0d5baae526c9df46ae17693bbba302640538b\\byte-buddy-1.9.0.jar"}],"tool":"D8"}
com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy-agent\1.9.0\37b5703b4a6290be3fffc63ae9c6bcaaee0ff856\byte-buddy-agent-1.9.0.jar
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
	at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
	at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
	at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:308)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:221)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:217)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
	at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:212)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
	at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
	at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy-agent\1.9.0\37b5703b4a6290be3fffc63ae9c6bcaaee0ff856\byte-buddy-agent-1.9.0.jar
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:805)
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$8(DexArchiveBuilderTransform.java:730)
	at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
	at com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:175)
	at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:152)
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:800)
	... 6 more
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
	at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:76)
	at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:45)
	at com.android.tools.r8.D8.run(D8.java:88)
	at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:147)
	... 7 more
Caused by: com.android.tools.r8.utils.AbortException
	at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:77)
	at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:58)
	at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:67)
	... 10 more

:crawler:transformClassesWithDexBuilderForDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':_crawler:transformClassesWithDexBuilderForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy-agent\1.9.0\37b5703b4a6290be3fffc63ae9c6bcaaee0ff856\byte-buddy-agent-1.9.0.jar

* 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

BUILD FAILED in 8s

Android Studio Error: java.exe” finished with non-z [Solved]

E rror:Execution failed for task ‘: app:preDexDebug ‘.

> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘C:\Program Files\Java\jdk1.8.0_ 51\bin\java.exe” finished with non-zero exit value 1

 

This is caused by a duplicate jar package during compilation

Or your jar package and the system default are repeated. Delete the jar package one by one and debug it