I'm trying to compile the sample cameraxbasic but I get this error:
Unresolved reference: WindowManager
I checked gradle files and there is that dependency.
I reviewed the library change log at https://developer.android.com/jetpack/androidx/releases/window and adjusted the sample with following these changes to make it work. Hope this helps!
use implementation "androidx.window:window:1.1.0-alpha01"
replace WindowManager with WindowInfoTracker
replace WindowManager(context) with WindowInfoTracker.getOrCreate(view.context)
replace windowManager.getCurrentWindowMetrics().bounds with WindowMetricsCalculator.getOrCreate().computeCurrentWindowMetrics(requireActivity()).bounds
Related
My code line is the following and I'm getting the error
Unresolved reference: ConcatAdapter
I already tried with MergeAdapter and it's still not working.
val concatAdapter = ConcatAdapter(headerAdapter, itemsAdapter)
Any idea of what could be wrong?
Do you have RecyclerView 1.2.0 in your grade file?
It was released in that version https://developer.android.com/jetpack/androidx/releases/recyclerview#version_120_3
Short version
I configured gitit to use its “Deprofanizer” plugin, but when I ran it, it failed, saying:
Loading plugin 'plugins/Deprofanizer.hs'...
plugins/Deprofanizer.hs:6:1: error:
Could not find module ‘Network.Gitit.Interface’
Use -v to see a list of the files searched for.
|
6 | import Network.Gitit.Interface
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gitit: Error loading plugin: plugins/Deprofanizer.hs
Apparently it found the plugin, but then couldn't compile it.
How do I fix this?
Longer detailed version
I've installed the gitit wiki software according to the instructions, using stack install. If I just run gitit, it works perfectly: it creates its static directory, initializes its database, and runs an HTTP service on port 5001, just as advertised.
But I can't get the plugins to work, for what seems to be a purely configuration-related issue.
The sample gitit configuration contains an explanation of how to configure plugins:
plugins:
# specifies a list of plugins to load. Plugins may be specified
# either by their path or by their module name. If the plugin name
# starts with Gitit.Plugin., gitit will assume that the plugin is
# an installed module and will not try to find a source file.
# Examples:
# plugins: plugins/DotPlugin.hs, CapitalizeEmphasisPlugin.hs
# plugins: plugins/DotPlugin
# plugins: Gitit.Plugin.InterwikiLinks
The default configuration uses no plugins. Several plugins are supplied with gitit, and the instructions here seem clear, so I tried turning on the Deprofanizer plugin by changing the plugins configuration to:
plugins: plugins/Deprofanizer.hs
as the sample suggested. (Deprofanizer is provided with gitit as an example.)
This almost works. When I start up gitit, it does locate the Deprofanizer module where I expect, and it attempts to compile it. But:
Loading plugin 'plugins/Deprofanizer.hs'...
plugins/Deprofanizer.hs:6:1: error:
Could not find module ‘Network.Gitit.Interface’
Use -v to see a list of the files searched for.
|
6 | import Network.Gitit.Interface
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gitit: Error loading plugin: plugins/Deprofanizer.hs
The Network.Gitit.Interface module is indeed part of the Gitit distribution, and I suppose it is compiled into my gitit executable. But I don't know why the plugin can't import it, or how to fix it. I can't find any hint in the manual that this might be a problem.
I found the code (in Network.Gitit.Plugins responsible for loading and compiling the plugin module:
loadPlugin pluginName = do
logM "gitit" WARNING ("Loading plugin '" ++ pluginName ++ "'...")
runGhc (Just libdir) $ do
...
and instrumented it to write out the value of libdir, which is /home/mjd/.stack/programs/x86_64-linux/ghc-8.6.5/lib/ghc-8.6.5. This directory exists, but I don't know what to do with it.
So again, the question is:
How do I fix this?
I compiled libdispatch.
This code is working:
import Dispatch
var lockQueue = dispatch_queue_create("com.test.async", nil);
But if I put this code to end file:
dispatch_async(lockQueue) {
print("test1");
}
I got an error:
use of unresolved identifier 'dispatch_async'
As I commented above, this appears to be a current limitation with the Swift Package Manager. It doesn't currently support the addition of the appropriate compile-time options, such as the ones needed to support blocks as inputs to GCD functions (-Xcc -fblocks).
In the meantime, you can avoid the Swift Package Manager and compile your files directly using swiftc, with the appropriate options. An example is provided by sheffler in their test repository:
swiftc -v -o gcd4 Sources/main.swift -I .build/debug -j8 -Onone -g -Xcc -fblocks -Xcc -F-module-map=Packages/CDispatch-1.0.0/module.modulemap -I Packages/CDispatch-1.0.0 -I /usr/local/include
The -I options will pull in your module maps for libdispatch, so adjust those to match where you've actually placed these system module directories.
I've been iterating on features in my first Gradle plugin. I determined early on that I needed commons-io, so I added a dependency on commons-io 2.4, being the latest version.
This has been going well for a while, with the build working from the command line, and no errors in Eclipse.
I just started trying to integrate some code that uses "FileUtils.write(File,String)". I didn't need that method before. I got everything un-redded in Eclipse, and then I tried a command line build.
This failed with errors like the following:
... error: cannot find symbol
FileUtils.write(serviceLoaderFile,
^
symbol: method write(File,String)
location: class FileUtils
This confused me. I went to the failing lines in Eclipse, and no issues were indicated. I navigated into the "write()" method, and it looked fine to me. I then ran my command-line build with "--debug" to get some clues.
When I found the "javac" line, I found that "$GRADLE_HOME\lib\commons-io-1.4.jar" (where "GRADLE_HOME" is just my Gradle 2.3 distribution) was in the classpath BEFORE my dependency jar. I then inspected the code in the 1.4 jar, and I determined that the "FileUtils" class in that version didn't have a "write" method.
What am I supposed to do about this?
Update:
I suppose it's likely my "dependencies" block would be useful, which is this:
dependencies {
compile ("org.codehaus.groovy:groovy-all:2.3.9")
compile gradleApi()
compile "org.opendaylight.yangtools:yang-parser-impl:0.7.0-SNAPSHOT"
compile "org.opendaylight.yangtools:binding-java-api-generator:0.7.0-SNAPSHOT"
compile "org.opendaylight.yangtools:binding-generator-api:0.7.0-SNAPSHOT"
compile "org.opendaylight.yangtools:binding-generator-impl:0.7.0-SNAPSHOT"
compile "org.opendaylight.controller:yang-jmx-generator:0.3.0-SNAPSHOT"
compile "commons-io:commons-io:2.4"
testCompile("org.spockframework:spock-core:1.0-groovy-2.3") {
exclude group: "org.codehaus.groovy"
}
I tried commenting out the "gradleApi" reference, and that had no effect. I also tried adding an "exclude" for commons-io associated with the "groovy-all" reference, but that also didn't appear to make any difference.
}
You probably added gradleApi() under dependencies {} block - see the docs. The problem is that it ships all dependencies gradle requires - including commons-io in version 1.4 - see the extract below:
[opal#opal-mac-2]~/.gvm/gradle/current/lib % pwd
/Users/opal/.gvm/gradle/current/lib
[opal#opal-mac-2]~/.gvm/gradle/current/lib % ll commons-io-1.4.jar
-rw-rw-r-- 1 opal staff 109043 23 gru 13:17 commons-io-1.4.jar
[opal#opal-mac-2]~/.gvm/gradle/current/lib %
You probably added version 2.4 separately and that's why conflict occurred. You can also run
gradle dependencies
to view the full dependency tree and verify the problem.
There's no possibility to exclude a transitive dependency from gradleApi().
The solution to this required adding the following block to the "sourceSets" block:
main {
compileClasspath = configurations.compile.minus files("$gradle.gradleHomeDir/lib/commons-io-1.4.jar")
}
This is pretty simple, but I wish there was a cleaner solution for this. I'm not sure what that would look like.
I have a CMake module to locate FreeGLUT:
FIND_PATH(FREEGLUT_INCLUDE_DIR NAMES GL/freeglut.h)
FIND_LIBRARY(FREEGLUT_LIBRARY NAMES freeglut freeglut_static)
SET(FREEGLUT_LIBRARIES ${FREEGLUT_LIBRARY})
SET(FREEGLUT_INCLUDE_DIRS ${FREEGLUT_INCLUDE_DIR})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FreeGLUT DEFAULT_MSG FREEGLUT_LIBRARY FREEGLUT_INCLUDE_DIR)
MARK_AS_ADVANCED(FREEGLUT_INCLUDE_DIR FREEGLUT_LIBRARY)
It works fine and locates freeglut_static.lib when I generate NMake Makefiles on Windows. I'm attempting to statically link FreeGLUT into my DLL:
FIND_PACKAGE(FreeGLUT REQUIRED)
ADD_LIBRARY(vti SHARED ${VTI_SOURCES})
ADD_DEFINITIONS("-DBUILD_VTI=1 -DFREEGLUT_STATIC=1")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${FREEGLUT_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(vti ${FREEGLUT_LIBRARIES})
My source code builds correctly, but when it gets to the linking stage, VC++ fails with:
LINK : fatal error LNK1104: cannot open file 'freeglut.lib'
Which is strange since freeglut.lib isn't mentioned anywhere that I can see in the generated NMake makefiles. It should be trying to link with freeglut_static.lib, which CMake locates and sets in FREEGLUT_LIBRARIES.
What might be causing this?
This is caused with pragma directives in FreeGLUT code (see freeglut_std.h). Using FREEGLUT_STATIC should really fix that for you, but I think you should pass it to CMake without quotes: ADD_DEFINITIONS(-DBUILD_VTI -DFREEGLUT_STATIC)