标签: native

Maven - 添加jar-with-dependencies作为依赖项

问题..
我想在与其依赖关系打包的Maven jar上添加一个依赖项.

详细信息..
我有一个多模块Maven项目,其中一个模块依赖于本机库等.作为它构建的一部分,它将它的依赖关系打包成jar-with-dependencies如下所示:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.4</version>
    <configuration>
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <archive>
            <manifest>
                <mainClass>${mainClass}</mainClass>
            </manifest>
        </archive>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

一切都很好,我建立时得到两个罐子:

seaniscool-0.0.1-SNAPSHOT.jar
seaniscool-0.0.1-SNAPSHOT-jar-with-dependencies.jar
Run Code Online (Sandbox Code Playgroud)

但是,我想在同一项目的另一个模块中使用此工件.如果我只是将模块添加为依赖项,那么我将获得没有包含本机库的jar.

我可以复制构建配置以包含第二个模块中的本机库,它不是非常广泛,但不愿意.

任何想法我如何添加jar-with-dependencies作为依赖,因此依赖于包含的库?

一些想法..
我知道我可以用Maven可以引用的测试类构建一个单独的jar:

在第1单元中:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.2</version>
    <executions>
        <execution>
            <goals>
                <goal>test-jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

在第二个模块中:

<dependency>
    <groupId>my.group.id</groupId>
    <artifactId>my.artifact.id</artifactId>
    <version>my.version</version>
    <type>test-jar</type>
    <scope>test</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)

这个概念可能在这里转移吗?

dll dependencies native jar maven

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

Android 4.3:unkown.unknown中的本机崩溃

我在Android 4.3上收到此错误.由Google开发者控制台报告.我的客户抱怨一旦他们打开它就会崩溃.

请告诉我应该怎么做.这不是我可以处理的事情,因为错误不是通常的java错误消息.

同样的错误来自以下Android设备:

HTC One(m7)

Galaxy Note3(hltetmo)

HTC One max(t6ul)

Galaxy S3(d2can)

错误 :

Build fingerprint: 'htc/htc_europe/m7:4.3/JSS15J/264544.1:user/release-keys'
Revision: '3'
pid: 5659, tid: 5673, name: Thread-6011 >>> net.superlinux.generalengineeringpaid <<<
signal 16 (SIGSTKFLT), code -6 (SI_TKILL), fault addr --------
r0 422ea818 r1 00000000 r2 6e09e007 r3 00000000
r4 6bc420f0 r5 69fbffd8 r6 67689198 r7 000042f4
r8 409d21c0 r9 6c495dd4 sl 40a78c48 fp 422ea818
ip 6d1a9c34 sp 6c495da0 lr 00000000 pc 6e09e020 cpsr 600d0030
d0 0000000000000000 d1 0000000000000000
d2 d1d1d1d1d1d1d1d1 d3 d1d1d1d1d1d1d1d1 …
Run Code Online (Sandbox Code Playgroud)

crash android native

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

How can I create custom switches in android with text on both side of switch's track an in thumb?

How can I design custom switch in android as like in below image:

状态 1

When it's turned on, it needs to look like this

状态 2

I also need to show toggle animation effects while switching between two categories. How Can I achieve it? Is there any 3rd party SDK or libraries available? Currently I have designed it with a custom linear layout as like this:

my_layout.xml:

 <LinearLayout
                android:id="@+id/customSliderLayout"
                android:layout_width="@dimen/_200sdp"
                android:layout_height="@dimen/_39sdp"
                android:layout_centerInParent="true"
                android:orientation="horizontal"
                android:weightSum="2"
                android:background="@drawable/oval_layout_bg"
                android:layout_centerHorizontal="true">

                <Button
                    android:id="@+id/userBtn"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:textAllCaps="false"
                    android:text="@string/toggle_user" …
Run Code Online (Sandbox Code Playgroud)

android native android-switch

12
推荐指数
2
解决办法
6309
查看次数

Flutter - ListView.builder:初始滚动位置

我想设置 ListView.builder 的初始滚动位置,我希望列表从底部开始 0.0

如果我reverse在 listView 上进行设置,我当然会得到初始滚动位置是所需的位置,但我需要的是将最后一个孩子放在底部,这是一个聊天应用程序。

这是列表生成器,MessageItem()是聊天消息

ListView.builder(
                    shrinkWrap: true,
                    controller: _scrollController,
                    itemCount: snapshot.data.documents.length,
                    padding: EdgeInsets.all(10.0),
                    itemBuilder: (BuildContext context, int index) =>
                        MessageItem(
                            index: index,
                            document: snapshot.data.documents[index],
                            myId: myId));

Run Code Online (Sandbox Code Playgroud)

这是我收到send消息时的动画


_scrollController.animateTo(
                _scrollController.position.maxScrollExtent,
                duration: const Duration(milliseconds: 500),
                curve: Curves.easeOut);
Run Code Online (Sandbox Code Playgroud)

动画工作正常。


我想要的是当用户进入聊天室时列表滚动位置已经在底部。

listview chat native dart flutter

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

如何确定.NET程序集是否包含非托管代码?

包含托管代码和非托管代码混合的.NET程序集不能与其他程序集进行ILMerged.

如何验证给定的.NET程序集是包含纯托管代码,还是托管代码和非托管代码的混合?

.net assemblies native unmanaged

11
推荐指数
2
解决办法
4762
查看次数

如何在maven的java.library.path变量中包含本机库

我正在尝试将JNotify用于我的应用程序,它具有以下要求

只需运行带有以下命令的jar文件即可测试JNotify:java -Djava.library.path =.-jar jnotify-VER.jar [dir]

然后,JNotify将监视指定的目录(如果未指定dir,则监视当前目录)并打印检测到的事件.请注意,java.library.path应指向jnotify附带的本机库位置(dll,所以dylibs等).

但是试图与maven一起工作并不成功.我试图运行一个简单的测试,但我得到以下错误

    java.lang.UnsatisfiedLinkError: no jnotify in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at net.contentobjects.jnotify.linux.JNotify_linux.<clinit>(Unknown Source)
    at net.contentobjects.jnotify.linux.JNotifyAdapterLinux.<init>(Unknown Source)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)        
Run Code Online (Sandbox Code Playgroud)

这意味着在库路径上找不到本机文件.

我的pom.xml看起来像这样 -

我已经将jar和.so添加到我们的内部存储库中

<dependency>
            <groupId>net.contentobjects</groupId>
            <artifactId>jnotify</artifactId>
            <version>0.93</version>
</dependency>
<dependency>
           <groupId>net.contentobjects</groupId>
           <artifactId>jnotify</artifactId>
           <version>0.93</version>
           <type>so</type>
</dependency>


<plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-surefire-plugin</artifactId>
     <configuration>
            <argLine>-Djava.library.path=target/lib/</argLine>
     </configuration>
</plugin>

<plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-dependency-plugin</artifactId>
     <executions>
       <execution>
              <id>copy</id>
              <phase>compile</phase>
              <goals>
                     <goal>copy</goal>
              </goals>
              <configuration>
                    <artifactItems>
                      <artifactItem>
                             <groupId>net.contentobjects</groupId>
                             <artifactId>jnotify</artifactId>
                             <version>0.93</version>
                             <type>so</type>
                             <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}/lib</outputDirectory>
                     </artifactItem>
                     </artifactItems>
               </configuration>
             </execution>
          </executions> …
Run Code Online (Sandbox Code Playgroud)

native maven

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

如何使用javascript更改视频标签海报属性?

我想使用本机JavaScript或jQuery来更改HTML视频标记上的poster属性.任何帮助将不胜感激.

<div id="videoplayer" class="video-player" style="overflow: hidden; width: 582px; height: 326px; "> 
    <div id="myPlayer"> 
        <video id="htmlFive" width="100%" height="100%" controls="" poster="undefined">
            <source src="blank.m3u8">
        </video>
</div> 
     </div>
Run Code Online (Sandbox Code Playgroud)

谢谢!

javascript jquery native poster html5-video

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

如何在matlab中检查本机ODBC连接的状态?

问题简介:

主要问题不在连接过程中,我可以成功连接到数据库,并在我的数据库中插入一些行(第一个代码块显示这个),但在关闭连接后,如果有人试图在数据库中插入一行,matlab将突然终止没有任何明确的错误消息,(我希望有一个功能来检查连接是否打开或关闭或获取错误消息来处理错误,但没有发生这些事情,只是因为致命的错误而关闭了matlab)

我写了以下代码连接到matlab中的MS SQL SERVER数据库:

conn=database.ODBCConnection('MS SQL SERVER','','');
insert(conn,'trace',{'obj_id','obj_type_id','time_step','pos_x','pos_y','vel_x','vel_y'},[1,1,1,0,0,0,0]);
close(conn);
Run Code Online (Sandbox Code Playgroud)

一切都很好.

然后我试图插入另一行(以检查错误消息是什么)然后Matlab关闭(由于致命错误)而没有显示任何错误消息.

在插入新raw之前,我尝试使用以下函数来获取数据库连接的状态:

isconnection(conn);
ping(conn);
Run Code Online (Sandbox Code Playgroud)

但它说

未定义的函数'ping'表示'database.ODBCConnection'类型的输入参数.

对于'database.ODBCConnection'类型的输入参数,未定义的函数'isconnection'

即使我试图使用try-catch块,但它没有工作和Matlab关闭致命错误.

所以我想知道是否有任何方法来解决原生ODBC的状态,以防止在关闭连接的情况下突然关闭matlab?


更新:

>> conn=database.ODBCConnection('MS SQL SERVER','','')

conn = 

ODBCConnection with properties:

  Instance: 'MS SQL SERVER'
  UserName: ''
   Message: []
    Handle: [1x1 database.internal.ODBCConnectHandle]
   TimeOut: 0
AutoCommit: 0
      Type: 'ODBCConnection Object'

 >> close(conn)
 >> conn

 conn = 

 ODBCConnection with properties:

  Instance: 'MS SQL SERVER'
  UserName: ''
   Message: []
    Handle: [1x1 database.internal.ODBCConnectHandle]
   TimeOut: 0
AutoCommit: 0
      Type: 'ODBCConnection Object'
Run Code Online (Sandbox Code Playgroud)

在关闭连接之前和之后没有更改任何属性或消息,问题是我不知道如果在程序的其他部分中连接仍然打开或关闭,如何检查!在这种情况下如果我在连接关闭之前使用插入命令,matlab突然终止(并显示消息MATLAB(R2013B)已停止工作),所以我想知道有没有办法检查本机odbc连接是否有关闭之前?


进一步更新

>> …
Run Code Online (Sandbox Code Playgroud)

database matlab odbc native

11
推荐指数
1
解决办法
963
查看次数

SIG33在调试原生Android时

我正在使用Android Studio来调试用C++编写的NativeActivity应用程序
在我的C++代码中,我做的第一件事android_main()就是等待10秒钟让调试器附加.在"调试"窗口中,我看到:

Now Launching Native Debug Session
Run Code Online (Sandbox Code Playgroud)

然后几秒钟后

Debugger attached to process 28458
Run Code Online (Sandbox Code Playgroud)

然后在它附加之后,调试器停止并发出一个信号:

Signal: 33 (signal SIG33)
Run Code Online (Sandbox Code Playgroud)

我按"恢复程序"然后我一次又一次地得到相同的信号7-8次.之后,程序按预期继续,调试器附加,我能够在断点处停止它.

SIG33的含义是什么?我该怎样预防呢?

c++ debugging android native android-ndk

11
推荐指数
1
解决办法
1261
查看次数

在Xamarin for Android中启用AOT(Visual Studio)

我知道Xamarin for Android支持AOT.软件免费后,它的所有功能也都免费.我阅读了文档并通过修改project.csproj文件启用了AOT ,如下所示:

<AotAssemblies>True</AotAssemblies>
Run Code Online (Sandbox Code Playgroud)

确保我的项目路径不包含空格(中断处理)后,我跑了构建和我的APK 两个托管的.NET的DLL 本地编译库.可悲的是,该应用程序似乎使用.NET DLL并完全忽略本机库.有什么办法可以解决这个问题吗?

编辑:阅读其他一些与Mono AOT相关的问题,似乎这可能是它应该如何工作的.我想AOT编译我的应用程序,希望减少~2秒的启动时间,这在我从JIT切换到AOT之后根本没有改变.有人可以向我解释这个吗?

奖励:有什么方法可以启用高级优化标志?(自我)

c# native compilation aot xamarin

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