I am having problems figuring out what to do to solve this error.
I tried invalidating caches/restart, freed up disk space and reinstalling Android Studio.
The following classes could not be instantiated:
- android.support.v7.widget.AppCompatTextView(Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE.If this is an unexpected error you can also
try to build the project, then manually refresh the layout.Exception Details java.lang.NullPointerException
at android.content.res.Resources_Delegate.getValue(Resources_Delegate.java: 788)
at android.content.res.Resources.getValue(Resources.java: 1286)
at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java: 212)
at android.support.v4.content.res.ResourcesCompat.getFont(ResourcesCompat.java: 206)
at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119)
at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208)
at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:152)
at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38)
at android.support.v7.widget.AppCompatTextView. < init > (AppCompatTextView.java:81)
at android.support.v7.widget.AppCompatTextView. < init > (AppCompatTextView.java: 71)
at java.lang.reflect.Constructor.newInstance(Constructor.java: 423)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java: 858)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java: 834)
at android.view.LayoutInflater.inflate(LayoutInflater.java: 492)
at com.android.layoutlib.bridge.bars.CustomBar. < init > (CustomBar.java:95)
at com.android.layoutlib.bridge.bars.StatusBar. < init > (StatusBar.java: 67)
at com.android.layoutlib.bridge.impl.Layout.createStatusBar(Layout.java: 224)
at com.android.layoutlib.bridge.impl.Layout. < init > (Layout.java: 146)
This appears to be a bug: Preview render problem when adding maven.google.com as a maven repo.
It is triggered if the new maven repo is used within the project level build.gradle:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Unfortunately, we don't seem to have another source for the most recent support library versions (26 and above) since they are apparently not present in the SDK Manager any more:
The support libraries are now available through Google's Maven
repository. We no longer support downloading the libraries through the
SDK Manager, and that functionality will be removed soon.
All of that said, this problem seems only to affect the designer in Android Studio. You should be able to build and run the app even though the designer complains.
What you apparently won't be able to do is see a nice, quick preview of your layout's TextView elements.
Finally, the designer preview does not seem to have this particular bug in Android Studio v3, which is currently in beta. So, you might want to upgrade and see how that works for you.
Refer this answer here.
Updating the current theme parent to Base theme in styles.xml seems working.
Related
I received this exception on release build with Android 12.
exception.class.missing._Unknown_: java.lang.AbstractMethodError abstract method "void android.content.pm.PackageManager$OnChecksumsReadyListener.onChecksumsReady(java.util.List)"
at android.app.ApplicationPackageManager$2.onChecksumsReady (ApplicationPackageManager.java:969)
at android.content.pm.IOnChecksumsReadyListener$Stub.onTransact (IOnChecksumsReadyListener.java:87)
at android.os.Binder.execTransactInternal (Binder.java:1184)
at android.os.Binder.execTransact (Binder.java:1143)
Anyone knows reason behind this? or How to fix this issue!?
Related to the common AbstractMethodError, you can get more information from this topic: https://stackoverflow.com/a/17970129/19303683
In my case, i get this problem when i try to downgrade target sdk to 30. My solution is:
Find all dependencies related to work-runtime (such as firebase ads) using Gradlew and downgrade them.
Remove this code from gradle if you have:
configurations.all {resolutionStrategy { force
'androidx.work:work-runtime:2.6.0' }}
I am trying to debug an existing Android app that uses tensorflow-lite to detect objects. The app implements the tensorflow library like below :
implementation('org.tensorflow:tensorflow-lite:0.0.0-nightly') { changing = true }
implementation('org.tensorflow:tensorflow-lite-gpu:0.0.0-nightly') { changing = true }
implementation('org.tensorflow:tensorflow-lite-support:0.0.0-nightly') { changing = true }
But examples I have found online for object detection, have implemented tensorflow-lite in the following way :
implementation 'org.tensorflow:tensorflow-lite-task-vision:0.2.0'
My questions are:
What is the difference between using the nightly snapshot and the "normal" library. From what I can gather online, the nightly build is an experimental branch and may contain bugs? I'm just confused about this because the existing app does not contain a reference to sonatype maven repository, which I understand was required to get the nightly builds to work in the app.
allprojects {
mavenCentral
maven {
name 'ossrh-snapshot'
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
}
My second question is what does this do line do : { changing = true } ?
PS: We are using our own custom trained model/tflite.
Changing, or snapshot versions are used when you need Gradle to get a new version of the dependency with the same name from time to time (once in 24 hours, unless specified explicitly otherwise).
I believe that whoever chose the nightly version of tensorflow, was wrong. As you say, this version may have bugs, and worse, these bugs will change overnight. Find some fixed version that you are comfortable with, study its changelog, and reset your implementation to refer to this version.
I am trying to implement custom lint checks (using Kotlin). I have set up a module for my custom checks and added classes to test my first lew lint check, mostly following these two tutorials here and here.
So I now have a module, I have a custom IssueRegistry, I've created an issue and a Detector class for it. So far it seems complete. I've added a test to check if my lint check works and it looks alright.
I have added my module to the project by referencing it in settings.gradle like this: include ':app', ':somemodule', ':mylintmodule'
Now if I run the linter using ./gradlew lint I get a lint result file telling me this:
Lint found an issue registry (com.myproject.mylintmodule) which requires a newer API level. That means that the custom lint checks are intended for a newer lint version; please upgrade
Lint can be extended with "custom checks": additional checks implemented by developers and libraries to for example enforce specific API usages required by a library or a company coding style guideline.
The Lint APIs are not yet stable, so these checks may either cause a performance degradation, or stop working, or provide wrong results.
This warning flags custom lint checks that are found to be using obsolete APIs and will need to be updated to run in the current lint environment.
It may also flag issues found to be using a newer version of the API, meaning that you need to use a newer version of lint (or Android Studio or Gradle plugin etc) to work with these checks.
To suppress this error, use the issue id "ObsoleteLintCustomCheck" as explained in the Suppressing Warnings and Errors section.
So it tells me that I am using a newer API verion in my custom lint check, right? This is my custom IssueRegistry (minus some parts not relevant for this problem):
class MyCustomIssueRegistry : IssueRegistry() {
override val issues: List<Issue>
get() = listOf(ISSUE_NAMING_PATTERN)
override val api: Int = com.android.tools.lint.detector.api.CURRENT_API
override val minApi: Int = 1
}
From googling this problem and finding this issue I figured I have to override and set the right API version (and maybe the min API?) by overriding these properties like I did above (this version is my last attempt, directly taken from that issue).
So this property can be set to values between -1 and 5, meaning this (taken right out of the lint.detector.api class):
/** Describes the given API level */
fun describeApi(api: Int): String {
return when (api) {
5 -> "3.5+" // 3.5.0-alpha07
4 -> "3.4" // 3.4.0-alpha03
3 -> "3.3" // 3.3.0-alpha12
2 -> "3.2" // 3.2.0-alpha07
1 -> "3.1" // Initial; 3.1.0-alpha4
0 -> "3.0 and older"
-1 -> "Not specified"
else -> "Future: $api"
}
I have tried all of them, plus the one above adding a minApi override too, and I keep getting the exact same result for each of them.
Also I am unable to locate what other API version this is compared with. Is there a place where this is set for the regular linter in an Android project?
It's also unclear to me what I have to do to make sure my changes got applied - is it enough to change some code, then run lint, or do I have to compile the project first, or build & clean?
Following the tutorials, I added my custom lint check by adding this to the app's build.gradle: lintChecks project(":mylintmodule")
Is that even right? The API issue on my registry class shows up no matter if my lint check is referenced (and hopefully used) like that or not. I have also tried the other method described in the first tutorial, adding this task to the linter module build.gradle:
defaultTasks 'assemble'
task copyLintJar(type: Copy) {
description = 'Copies the lint jar file into the {user.home}/.android/lint folder.'
from('build/libs/')
into(System.getProperty("user.home") + '/.android/lint')
include("*.jar")
}
// Runs the copyLintJar task after build has completed.
build.finalizedBy(copyLintJar)
But since I can't figure out how to see if my custom checks are actually run, I don't know if that works as intended either.
So how do I get this warning resolved (since I interpret the text as "As long as the versions don't match I will not try to run your lint check"), and how can I make sure my lint check is actually run by the linter?
I'm trying to develop apps for EPSON Moverio BT-2000.
I'm new to android studio and I don't understand why I can't use some methods from a library which I have imported (correctly, I supposed).
So, I have add my lib in a folder name libs, right click on it, add as Library.
I checked in builds.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/H725Ctrl.jar') // this lib
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.0.3'
}
Moreover, I can use some elements (Methods, String definitions etc..) but some not. I don't understand why and how it's possible.
If it's necessary I can publish my source code.
Have you some ideas.?
Thanks.
Franck
NB: the lib I use is depreciated by android
NB2: Exemple
Camera.Parameters params = l_pCamera.getParameters();
// I can do this and getParameters() works
List<String> Supported = params.getSupportedEpsonCameraModes();
//I can't invoke getSupportedEpsonCameraModes() or methods are in the same file
I contacted EPSON and they said it's a common problem.
So they send me a pdf which indicate how solve the problem..
It's strange..
NB the content of the PDF: sorry for the presentation but it will be helpful for someone..
1/2
Remark for using Android Studio
In case of using BT-2000 SDK with Android Studio, there may happen to have a failure during a build process. It may cause the conflict of the name between standard SDK and Epson expanded SDK. It is happened especially with “android.hardware.Camera” class.
It may resolve a failure with following action.
1. Sore H725Ctrl.jar at designated folder which is created by user like C:\Users\<user name\AndroidStudioProjects\<application name>\app\libs
2. Set change of gradle by selecting “Sync Project with Gradle Files” button which is located upper of Android Studio screen.
3. Open “build.gradle” for specified project with specified application name by selecting left side button on Android Studio screen. Then edit with following contents.
allprojects { repositories { jcenter() } gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs.add('-Xbootclasspath/p:C:/Users/<user name>/AndroidStudioProjects/<application name>/app/libs/H725Ctrl.jar') } } }
4. Execute “Clean Project” then “Make Project” in Android Studio Build menu.
5. If error occurs in Make project process, end Android Studio and restart it.
2/2
6. There may still remain several name conflicts with Android standard API like “getSupportedEpsonCameraModes()”. Ignore and “run application” to set it into target BT-2000.
[ Caution ]
It works temporally with following action;
Open
C:\Users\<user name>\AndroidStudioProjects\<application name>\app\app.iml
Move line of
<orderEntry type="library" exported="" name="H725Ctrl" level="project" />
to upper line of
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
This will help H725Ctrl.jar to be higher priority, however performing rebuild function will affect to reset name conflict issue.
Object which is performed build function already works well.
It's weird. Epson tries to override some Android specific classes in their jar:
android.hardware.Camera
android.hardware.Camera.Parameters
These classes are part of the Android SDK (http://developer.android.com/reference/android/hardware/Camera.html). I do not know Epson would like to achieve, if they bundle the classes with their SDK. Maybe you could change the packagename in the H725Ctrl.jar to something like
com.epson.hardware
with JarJar (https://github.com/shevek/jarjar)?
Add the following code to your build.gradle file. The problem could be that the Moverio Camera class uses the same namespace as the Android sdk and there is an ordering issue
allprojects {
repositories {
jcenter()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs.add('-Xbootclasspath/p:C:/Source/EPSONProBT-2000ServiceMaintenance/app/libs/H725Ctrl.jar')
}
}
}
How can I set the HTTP_ACCEPT_LANGUAGE header with CrossWalk?
I've tried looking for the same methods as the original Android webview (like described here: How can I override Android WebView to use custom Accept-Language header?) but no luck.
The normal webview sends the correct header, CrossWalk however doesn't include my native language, just 'en-US'.
I ended up editing the source, and then compiling from scratch.
If you want to do the same, the file to look in is "xwalk/runtime/browser/runtime_url_request_context_getter.cc"
Link to the file on Github
And then look for this:
storage_->set_http_user_agent_settings(
new net::StaticHttpUserAgentSettings("da-DK,da;q=0.8,en-US;q=0.6,en;q=0.4", base::EmptyString()));
In this we added the "da-DK,da;q=0.8", but you get the idea.
How to build Crosswalk from source
I had the same problem. I found out that the following beta version 15.44.384.8 accounts for this problem. So if you feel comfortable by using a beta version, you can find it here:
https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library_beta/
When using version 15.44.384.8 crosswalk will automatically select the language of your device settings.
You can add this version by modifing you build.gradle as follows:
repositories {
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
}
dependencies {
...other stuff...
compile 'org.xwalk:xwalk_core_library_beta:15.44.384.8'
}